bug-gawk
[Top][All Lists]
Advanced

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

Re: gensub() treats trailing backslash in replacement string inconsisten


From: Denys Vlasenko
Subject: Re: gensub() treats trailing backslash in replacement string inconsistently / surprisingly
Date: Sat, 3 Jun 2023 20:21:13 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0

On 6/3/23 19:52, Wolfgang Laun wrote:
There is a general problem with backslashes in the gensub replacement string.

$ awk 'BEGIN { s="b\\b\\";g=gensub("a",s,1,"a");print g; }' | od -tx1
0000000 62 62 00 0a

Yes, this is exactly the behavior I described.
If the string ends with a trailing backslash, the NUL will be inserted.




reply via email to

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