sh parameters in awk
Patrick Hyland
pjh at otter.hpl.hp.com
Sat Jan 21 06:01:59 AEST 1989
> 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.
More information about the Comp.unix.questions
mailing list