OT: Need some shell scripting hints ;)
Jason DeVita
yellowdog-general@lists.terrasoftsolutions.com
Wed Oct 1 15:46:00 2003
On Wed, 1 Oct 2003, Konstantin Riabitsev wrote:
> On Wed, 2003-10-01 at 17:28, nathan r. hruby wrote:
> > #!/bin/bash
> > line=`cat file`
> > for i in $line; do
> > /bin/something --to $i
> > done
> >
> > Would do it.
>
> Only if there are no whitespaces in the lines.
This is not a very elegant way to do it, but it should work:
for x in $(awk '{print NR}' file)
do
y=$(awk '{if(NR==x)print}' x=$x file)
do something to $y
done
-J