Originally posted by: alethad
Here's a copy of the awkc script file. I don't know perl very well but I collect different perl and unix scripts for my own use. I'm sure you could probably come up with something better if you know perl.
The default field separator is a space. But you can change it to fit your needs.
<hr />
#!/bin/ksh
-
awkc - print out one or more columns
p=\$$( echo $1 | sed 's/,/,\$/g' )
shift
eval "awk '{ print $p }'" $*
-
eof
<hr />
Examples of how to use the awkc. Just pipe any unix command to it to get whichever column of data you need.
ps -ef | grep $process |awkc 2
fd=`ls -al $i |awkc 7` #get file date
Hope that helps.