tech-userlevel archive

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

Re: awk gensub documentation



On Tue, 18 Jun 2024 at 07:57, Valery Ushakov <uwe%stderr.spb.ru@localhost> wrote:

> My eye accidentally caught this phrase in awk(1), that says in the
> description of gensub():
>
>   Note that the ‘\n’ sequences within replacement string s supported
>   by GNU awk are not supported at this moment.
>
> I assume what it means to say is \<n> backreferences, not the 0xa NL
> character, but I wanted to ask the audience.
>

In src/external/historical/nawk/dist/run.c around line 2137, this is the
definition of gensub(), which does the work

Cell *gensub(Node **a, int nnn) /* global selective substitute */
        /* XXX incomplete - doesn't support backreferences \0 ... \9 */

and, as I should not be commenting with information derived purely from
comments, I took a look and there's no code in gensub() that manipulates
backrefs.

Best,
Alistair


Home | Main Index | Thread Index | Old Index