I've been using this perl script to get a token out of stream on command line
1 #!/usr/bin/perl
2
3 $i = $ARGV[0];
4
5 while (<STDIN>) {
6 @tokens = split /\s+/;
7 print $tokens[$i] . "\n";
8 }
typical usage would be something like
mjeong@login:~/bin$ qstat | grep XXX.0.par
1664011 0.00063 XXX.0.par mjeong qw 11/05/2010 10:34:37 16
mjeong@login:~/bin$ qstat | grep XXX.0.par | token.pl 0
1664011
mjeong@login:~/bin$ qstat | grep XXX.0.par | token.pl 1
0.00063
Out of curiosity, is there a standard utility to do this with similar(=simple) interface - so that I don't have to write this little script for any new machine? I understand Awk/Sed can do this, but regex syntax is a little complicated to type every time (I need no brainer syntax, since I use this a lot)
Thanks,