bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: gawk "\\" "(" strange behavior ...


From: Jeff Chua
Subject: Re: gawk "\\" "(" strange behavior ...
Date: Wed, 8 Sep 2004 09:21:41 +0800 (SGT)


On Tue, 7 Sep 2004, Stepan Kasal wrote:

this works ...
echo "\\" | awk '{print $0; gsub(/\\/, "b"); print $0;}'
this doesn't ...
echo "\\" | awk '{print $0; gsub("\\", "b"); print $0;}'

in short, use the first variant, unless you have special needs.
The parameter is a regex, not a string.


Ok, I'll stick to /\\/ instead of "\\", but the following still puzzles me.

this works ...
echo ")" | awk '{print $0; gsub(/)/, "b"); print $0;}'

this doesn't ...
echo "(" | awk '{print $0; gsub(/(/, "b"); print $0;}'



It works with /\(/ and /\)/, but why does /)/ works and not /(/ ?


Thanks,
Jeff.





reply via email to

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