AWK/shell quoting (was: Re: Access to UNIX-Related Publications)

Brandon S. Allbery allbery at NCoast.ORG
Mon Jan 8 05:03:29 AEST 1990


As quoted from <1990Jan6.233340.9978 at smsc.sony.com> by dce at smsc.sony.com (David Elliott):
+---------------
| In article <18067 at umn-cs.CS.UMN.EDU> mike at umn-cs.cs.umn.edu (Mike Haertel) writes:
| >In article <166 at omaha1.UUCP> wcc at omaha1.UUCP (William C Carey) writes:
| >>Any of the luminaries out there know how to get 'awk' (not nawk) to ouput a
| >>single-quote character ( ascii 0x27 ).  I can't get the 'print' or
| 
| >2.  You can do it by cooperating with shell quoting.  This is hairy,
| >but will print a single quote:
| >
| >	awk 'BEGIN {print "'"'"'"}'
| 
| One trick I use is to say
| 
| 	awk 'BEGIN {
| 		Sq = "'"'"'";
+---------------

A variant on the above which doesn't require tricky quoting is:

	awk 'BEGIN {
		Sq = sprintf("%c", 39);

++Brandon
-- 
Brandon S. Allbery    allbery at NCoast.ORG, BALLBERY (MCI Mail), ALLBERY (Delphi)
      uunet!cwjcc.cwru.edu!ncoast!allbery ncoast!allbery at cwjcc.cwru.edu
*(comp.sources.misc mail to comp-sources-misc[-request]@backbone.site, please)*
*Third party vote-collection service: send mail to allbery at uunet.uu.net (ONLY)*



More information about the Comp.unix.questions mailing list