From: Etaoin Shrdlu <shrdlu@unlimitedmail.org>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Help with bash/awk script
Date: Wed, 23 Aug 2006 17:17:03 +0200 [thread overview]
Message-ID: <200608231717.03106.shrdlu@unlimitedmail.org> (raw)
In-Reply-To: <1156343437.6040.4.camel@neuromancer.home.net>
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
done
--
gentoo-user@gentoo.org mailing list
next prev parent reply other threads:[~2006-08-23 15:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-23 14:30 [gentoo-user] Help with bash/awk script Ow Mun Heng
2006-08-23 15:17 ` Etaoin Shrdlu [this message]
2006-08-23 16:07 ` Ow Mun Heng
2006-08-23 15:20 ` Bo Ørsted Andresen
2006-08-23 16:24 ` Ow Mun Heng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200608231717.03106.shrdlu@unlimitedmail.org \
--to=shrdlu@unlimitedmail.org \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox