[SunHELP] nawk and ksh

Belanger, Marc Marc.Belanger at mpi.com
Wed Feb 16 12:43:05 CST 2005


Greetings all,

I am observing weirdness with the nawk command in a ksh script, as
opposed to the ksh shell. Here's the short version (not!); I am patching
a rather large number of systems manually (for the last time, I hope),
and using Feb04 sun_recommended cluster. I'm trying to get rid of the
return code 2's, and 8's, although I won't mind a few 25's which I'll
clean up later. I'm dumping the output into patch_order for
install_cluster to use, instead of the complete 1* method.

The manual method gets me exactly what I want. I verified all the
patches on several machines. There really aren't that many on
semi-current machines; there are a ton on older boxes though.

# cd /8_patch/8rec # ls -ld1 1* |nawk '{print $9}'|sort -d >
/var/tmp/8rec.x # cd /var/tmp # showrev -p|nawk '{print $2}'|sort -d >
/var/tmp/show.x # comm -13 show.x 8rec.x |wc -l
       8

Until I run them from inside this script:
--- start ---
# more list.ksh
#!/bin/ksh

cd /8_patch/8rec
ls -ld1 1* | nawk '{print $9}'|sort -d > /var/tmp/8rec.xx
cd /var/tmp
showrev -p|nawk '{print $9}'|sort -d > /var/tmp/show.xx
echo "Scripted count is: `comm -13 show.xx 8rec.xx|wc -l`"
comm -13 show.xx 8rec.xx > /var/tmp/patch_order
echo "File count is: `wc -l < patch_order`"

# Just for fun I comm The manual nawks the exact same
# and they get a different number, what gives?
echo "Scripted count from manual nawks was: `comm -13 show.x 8rec.x|wc
-l`" exit
--- end ---
output:
# ./list.ksh
Scripted count was:      174
Scripted count from manual nawks was:        8

Any ideas from you folks would be helpful, as I would rather script the
patch_order generation. I'd only have to logon to the machine, instead
of typing it 9347653462452 times. :)

Thanks in advance.

Marc Belanger
MPI UNIX Support
617-551-3840





This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential, proprietary
and/or privileged.  This e-mail is intended only for the individual(s) to whom
it is addressed, and may not be saved, copied, printed, disclosed or used by
anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank
you.



More information about the SunHELP mailing list