bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to substitute in a string for the first n matches?


From: Peng Yu
Subject: Re: How to substitute in a string for the first n matches?
Date: Mon, 29 Mar 2021 09:44:38 -0500

On Mon, Mar 29, 2021 at 9:38 AM <arnold@skeeve.com> wrote:
>
> Unless your string is many megabytes long, you won't notice the time
> issue.

I don't want to assume how small the input is.

> There are other options, for example using patsplit and then putting
> the string back together as desired.

This incurs extra copying.

> In any case, gensub isn't going to be extended to allow arbitrary
> ranges and/or lists of occurrences to substitute.

Why it can not be extended? After all, the extension won't break any
existing function call convention.

> Gawk provides
> the basic building blocks as built-in functionality; more specific
> use cases should be dealt with in user defined functions.

The problem is that no current functionality in awk support efficient
implementation of this feature.

-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]