o.k., I admit it, I suck dead donkey dicks in hell at this.
I know I can do gooder - maybe you can help. The perl
below works, I just think its real ugly and I can't stand
the thought that the same thing using awk is simply:
cmd | awk '{ if ($1 ~ /^[0-9]*$/) {print $2}}' >> $outlist
One place I'm lost is with embedding carriage returns, which
awk does so nicely. I played with arrays, stripping extra \n's
after the loop, then after adding the stupid if statement below
to prevent the extra blank line, I just gave up thinking I need a
really good flogging. It was at this point I started to regret every
brain cell I lost between 1976 and 1986, so I decided to ask
you so I could get on with my life...
open( IN, "$cmd |");
while (<IN>) {
($f1,$f2) = split(' ', $_);
if ( $f1 =~ /^[0-9]*$/ ) {
if ( $list ) {
$list = "$list\n$f2"
} else {
$list = $f2
}
}
}
close IN;
open ( OUT, ">$oulist");
print OUT "$list";
close OUT;
thanks,
Mike