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

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

gawk "\\" "(" strange behavior ...


From: Jeff Chua
Subject: gawk "\\" "(" strange behavior ...
Date: Tue, 7 Sep 2004 11:50:22 +0800 (SGT)


Can someone please explain why I've to use /\\/ instead of "\\" to substitute "backslash" into "b" ...


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


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




Another one, this one is to substitute left-bracket for "b", but I've to escape it _two_ backslashes. Why not just _one_ backslash?

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

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



Thanks,
Jeff




reply via email to

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