On Wednesday 23 August 2006 16:30, Ow Mun Heng wrote: > (Does awk parse the file once or multiple times, that is if I were to > rewrite the below entirely in awk language)
awk parses the file only once. One line at a time. Of course that goes for
every invocation of awk... ;)
> finaltpi=`cat $1 | awk "/TPI chosen/" | awk -v pat="$x" '{if
> (NR==pat+1) print $5}'`
finaltpi=`awk -v pat="$x" '/TPI chosen/{if (NR==pat+1) print $5' < $x`
> tpiert=`egrep -i "(average)" $1 | awk -v pat="$i"
> '{ if(NR==pat) print $5","$10}'`
tpiert=`awk -v pat="$i" 'tolower($0)~/(average)/{ if(NR==pat) print $5","$10}'
< $1`
If you want more help with this I would suggest that you posted a short sample
input file and a sample of the output you want to achieve. It does make it a
heck of a lot easier to grasp what it is you want to do...
--
Bo Andresen
pgpTxkwuQN3Kq.pgp
Description: PGP signature

