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: arnold
Subject: Re: How to substitute in a string for the first n matches?
Date: Mon, 29 Mar 2021 11:32:31 -0600
User-agent: Heirloom mailx 12.5 7/5/10

Peng Yu <pengyu.ut@gmail.com> wrote:

> 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.

Test it, ON REAL DATA. Let's see some numbers showing that doing it
as a function is really a problem.

> > 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.

I didn't say it can't be extended. I said it won't be. The code in
gawk is already very complicated. Adding such a feature would make
it even worse, and I don't want to do it.

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

You have made an assertion that usng a function isn't efficient.
But that's all it is: an assertion. You have to prove now that
your assertion is correct by showing some timing values, using
your real data, and not something artificial.

If you're not willing to do that, well, then you can either live with
gawk as it is, revise the code yourself to add the feature, or discuss
my consulting rates with me (offline) to add the feature to gawk for you.

Thanks,

Arnold



reply via email to

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