1 |
On Wed, 2006-08-23 at 17:17 +0200, Etaoin Shrdlu wrote: |
2 |
> On Wednesday 23 August 2006 16:30, Ow Mun Heng wrote: |
3 |
> |
4 |
> > if [ "$x" -eq 0 ] |
5 |
> > then |
6 |
> > for i in `seq 1 7` <----- |
7 |
> > do |
8 |
> > tpiert=`egrep -i "(average)" $1 | awk -v pat="$i" |
9 |
> > '{ if(NR==pat) print $5","$10}'` |
10 |
> > echo $filename,$x,$y,$finaltpi,$tpiert |
11 |
> > ((y++)) |
12 |
> > done |
13 |
> > |
14 |
> > elif [ "$x" -eq 1 ] |
15 |
> > then |
16 |
> > for i in `seq 8 14` <----- |
17 |
> > do |
18 |
> > tpiert=`egrep -i "(average)" $1| awk -v pat="$i" |
19 |
> > '{ if(NR==pat) print $5","$10}'` |
20 |
> > echo $filename,$x,$y,$finaltpi,$tpiert |
21 |
> > ((y++)) |
22 |
> > done |
23 |
> > elif [ "$x" -eq 2 ] |
24 |
> |
25 |
> If I understand correctly, you want to avoid all the if/elif tests on $x. |
26 |
> |
27 |
> What about |
28 |
> |
29 |
> low=`expr $x \* 7 + 1` |
30 |
> high=`expr $low + 6` |
31 |
> |
32 |
> for i in `seq $low $high` ; do |
33 |
> |
34 |
> # your code here |
35 |
> |
36 |
|
37 |
This works _Great_!! |
38 |
|
39 |
Thanks. I was thinking along the same lines, but somehow can't get it |
40 |
right. |
41 |
|
42 |
-- |
43 |
gentoo-user@g.o mailing list |