AWK/shell quoting

brnstnd at stealth.acf.nyu.edu brnstnd at stealth.acf.nyu.edu
Mon Jan 8 09:34:25 AEST 1990


In article <6954 at lindy.Stanford.EDU> karish at forel.stanford.edu (Chuck Karish) writes:
>     awk 'BEGIN {print "'"'"'"}'
>                       1234321

That numbering may confuse some readers. How about this:

      awk 'BEGIN {print "'"'"'"}'
	  1--------------1   2--2
			  3-3
			4  -  4
			   5

The shell leaves single-quoted text (1-1,2-2) alone. It does a bit of
interpretation (none in this case) on the double-quoted text (3-3).
Awk sees a double-quoted string (4-4) and prints it. The string, of
course, is the completely uninterpreted single quote (5).

I would replace the "'" (3-3) by \', which is a few microseconds faster
and might save a bit of disk space and typing time. :-)

---Dan



More information about the Comp.unix.questions mailing list