Reputation: 2301
Here under, I expected two back slashes, but get one,
$ awk '{$0=gensub(/\[/,"\\\\","g")}1' <(echo [)
\
sub
works okay.
Thanks,
Eric J.
Upvotes: 0
Views: 88
Reputation: 40778
The behavior is explained here: http://www.gnu.org/software/gawk/manual/gawk.html#Gory-Details
From that link it can be seen that the there is a difference in behavior depending upon
awk
you are using, andgensub()
or sub()
Upvotes: 2