[wellylug] a bit of awk

Ewen McNeill wellylug at ewen.mcneill.gen.nz
Mon Mar 22 16:17:43 NZST 2004


In message <20040322032412.TMID27006.web1-rme.xtra.co.nz at there>, "E.Chalaron" wr
ites:
>     find /home -path '*.doc' | awk --field-separator=/ '{$3}'=$location
>     catdoc "${nom_file}" > "/home/$location/$(basename ${nom_file} .doc).txt"

Try:

location=`find /home -path '*.doc' | awk --field-separator=/ '{$3}'`
catdoc "${nom_file}" > "/home/$location/$(basename ${nom_file} .doc).txt"

or:

location=$(find /home -path '*.doc' | awk --field-separator=/ '{$3}')
catdoc "${nom_file}" > "/home/$location/$(basename ${nom_file} .doc).txt"

(which should be equivilent on a POSIX system, although as written 
I think it'll only work on a GNU system due to the long argument style).

Ewen




More information about the wellylug mailing list