Path: utzoo!attcan!uunet!lll-winken!ncis.llnl.gov!helios.ee.lbl.gov!nosc!ucsd!ucbvax!hplabs!otter!pjh From: pjh@otter.hpl.hp.com (Patrick Hyland) Newsgroups: comp.unix.questions Subject: Re: sh parameters in awk Message-ID: <1170015@otter.hpl.hp.com> Date: 20 Jan 89 20:01:59 GMT References: <7334@ihlpf.ATT.COM> Organization: Hewlett-Packard Laboratories, Bristol, UK. Lines: 30 > fdelim="c " > awk ' > BEGIN { > bd = "d " > fdelim = "'${fdelim}'" > } > ' hl_l1 When fdelim is "c ", after parameter substitution has been done on the awk command, awk has three arguments (the space in "c " acts as a field delimiter). The first of these arguments is: 'BEGIN { bd = "d " fdelim = "c' and awk correctly rejects this. The following does what you want: fdelim="c " awk ' BEGIN { bd = "d " fdelim = "'"${fdelim}"'" } ' hl_l1 Patrick Hyland. Hewlett-Packard Laboratories, Bristol, England.