[PLUG] shell scripting question
Colin Kuskie
ckuskie at dalsemi.com
Tue Oct 19 17:55:02 UTC 2004
On Tue, Oct 19, 2004 at 03:59:11PM -0700, Matt Alexander wrote:
> I'm trying to use awk to print several columns, however, I also want
> to run an external script on one of those columns. So, for example:
>
> cat $1 | tr -s ' ' | cut -f1,7,8 -d' ' | awk "{print $1,`foo.pl $1`,$3,$2}"
>
> This, of course, doesn't work. Basically I want to run foo.pl on
> awk's $1 and not bash's $1 and then print that value as the second
> column.
Do it all in perl?
while (<>) {
tr/ / /s;
@columns = split;
@columns = @columns(1,7,8); #Check for 0 based indexing versus 1 based
##Do what foo.pl does here
print join ',', @columns;
}
More information about the PLUG
mailing list