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