AWK/shell quoting (was: Re: Access to UNIX-Related Publications)
Paul Lew
lew at gsg.UUCP
Mon Jan 8 08:02:40 AEST 1990
>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
>the 'printf' statement to do it with any combination of backslashes,
>double-quotes, or percent characters.
Try avoid using quotes, double-quotes will make life a lot easier. I use
the following:
BEGIN { q = 39; }
{
printf "this is a quote: %c\n", q;
}
this free you up to worry about what you want to do instead of quoting
problem. Just remember the decimal value for quote is 39, I did not start
using this method until I memorized its value (the most intuitive reaction
a programmer has at that point is to use "quote" mostly because he can
not remember the decimal value for quote and dont feel like look into the
ASCII table for it!)
--
Paul Lew (lew at gsg.gsg.com) UUCP: oliveb---+
uunet---samsung--+
General Systems Group, 5 Manor Parkway harvard--+--gsg--lew
Salem, NH 03079 (603) 893-1000 decvax---+
More information about the Comp.unix.wizards
mailing list