I found an awk guru in this list and he is "Ledger, David" <david.ledger@aquila-networks.co.uk>. Thanks to others also, but David understood what I am doing and suggested what to do as below: nawk ' $1 ~ /^c/ { print "Device: " $1 cmd = "ls -l /dev/dsk/" $1 "s0" while (cmd | getline > 0) { tmp = substr($11, 14) gsub(/:a/, "", tmp) print tmp } close(cmd) next } $1 ~ /^r/ { cmd = "ls -l /dev/" $1 while (cmd | getline > 0) { tmp = substr($11, 14) gsub(/:/, "", tmp) print tmp } close(cmd) next } $1 ~ /Vendor/ { print; next } $1 ~ /RPM/ { print } ' My for loop is irrelevent to this and removed. Thanks again. Uman --- UmanS <kedaran0504@yahoo.com.au> wrote: > Hi managers, > > Any awk gurus out there? > > I have a awk script like this: > > {for (i = 1; i<=NF; i++) } > { > if ($1 ~/^c/) > { > print "Device: " $1 > system("ls -l /dev/dsk/" $1 "s0 |nawk '{print > $11}'| cut -c 14- |sed 's/:a//g'") > } > else > if ($1 ~/^r/) > { > print "Device: " $1 > system("ls -l /dev/" $1 "|awk '{print $11}' |cut > -c > 14- |sed 's/:$//g'") > } > if ($1 ~/Vendor/) print > if ($1 ~/RPM/) print > } > Presently I am calling this script from my ksh > script > to process a file. But I wuold like include these > lines into my ksh script. > How can I do it?. > > Thanks in advance. > UmanS > > > http://careers.yahoo.com.au - Yahoo! Careers > - 1,000's of jobs waiting online for you! > http://careers.yahoo.com.au - Yahoo! Careers - 1,000's of jobs waiting online for you! _______________________________________________ sunmanagers mailing list sunmanagers@sunmanagers.org http://www.sunmanagers.org/mailman/listinfo/sunmanagersReceived on Fri Nov 15 11:10:22 2002
This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:42:58 EST