Xref: utzoo comp.unix.questions:18922 comp.unix.wizards:20092 Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!usenet.ins.cwru.edu!cwjcc!ncoast!allbery From: allbery@NCoast.ORG (Brandon S. Allbery) Newsgroups: comp.unix.questions,comp.unix.wizards Subject: Re: AWK/shell quoting (was: Re: Access to UNIX-Related Publications) Message-ID: <1990Jan7.180329.13144@NCoast.ORG> Date: 7 Jan 90 18:03:29 GMT References: <487@longway.TIC.COM> <166@omaha1.UUCP> <18067@umn-cs.CS.UMN.EDU> <1990Jan6.233340.9978@smsc.sony.com> Reply-To: allbery@ncoast.ORG (Brandon S. Allbery) Followup-To: comp.unix.questions Organization: North Coast Public Access UN*X, Cleveland, OH Lines: 29 As quoted from <1990Jan6.233340.9978@smsc.sony.com> by dce@smsc.sony.com (David Elliott): +--------------- | In article <18067@umn-cs.CS.UMN.EDU> mike@umn-cs.cs.umn.edu (Mike Haertel) writes: | >In article <166@omaha1.UUCP> wcc@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@NCoast.ORG, BALLBERY (MCI Mail), ALLBERY (Delphi) uunet!cwjcc.cwru.edu!ncoast!allbery ncoast!allbery@cwjcc.cwru.edu *(comp.sources.misc mail to comp-sources-misc[-request]@backbone.site, please)* *Third party vote-collection service: send mail to allbery@uunet.uu.net (ONLY)*