|
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.
[Prev in Thread] | Current Thread | [Next in Thread] |