On Wed, 2006-08-23 at 17:17 +0200, Etaoin Shrdlu wrote:
> On Wednesday 23 August 2006 16:30, Ow Mun Heng wrote:
>
> > if [ "$x" -eq 0 ]
> > then
> > for i in `seq 1 7` <-----
> > do
> > tpiert=`egrep -i "(average)" $1 | awk -v pat="$i"
> > '{ if(NR==pat) print $5","$10}'`
> > echo $filename,$x,$y,$finaltpi,$tpiert
> > ((y++))
> > done
> >
> > elif [ "$x" -eq 1 ]
> > then
> > for i in `seq 8 14` <-----
> > do
> > tpiert=`egrep -i "(average)" $1| awk -v pat="$i"
> > '{ if(NR==pat) print $5","$10}'`
> > echo $filename,$x,$y,$finaltpi,$tpiert
> > ((y++))
> > done
> > elif [ "$x" -eq 2 ]
>
> If I understand correctly, you want to avoid all the if/elif tests on $x.
>
> What about
>
> low=`expr $x \* 7 + 1`
> high=`expr $low + 6`
>
> for i in `seq $low $high` ; do
>
> # your code here
>
This works _Great_!!
Thanks. I was thinking along the same lines, but somehow can't get it
right.
--
[email protected] mailing list