It's differences between the output of solaris ps and linux ps. You'll probably have to make modifications with allowances for the different OSes. You could probably do some case switching magic to do it all in one script, though.
Anyway, I don't have access to a solaris box at the moment, so my suggestion is to start with the base command and work down from there, adding on the pipes one at a time until you figure out where the difference is.
Do:
ps -ef | grep nco_p_syslog
on both, then compare the output. If you don't understand what each command does, you should spend some time reading the various manual pages until you do.
I only want the dc000p part to record to the dat file.
For the life of me I can not seem to figure out the awk commands to do that.
Any help would be great also explaining how the awk would work how its being used above. I am very new to it and the stuff I am reading is a bit confusing so far.
Haha, I just realized that I added an unnecessary cut.
If you change your -F_ to a -F. it should work without the cut. Those two commands:
awk -F. '{print $2}'
and
cut -d '.' -f 2
are pretty much identical here. The -F_ in awk tries to split fields using _ as a separator. You want to split using a period. The -d '.' in the cut command is the same thing.
And compare the outputs. You're not going to find out what the difference is until you compare the raw output.
It's entirely possible that the results returned will be different depending on a lot of factors, you'll just have to adjust your script to account for those differences.
#!/bin/ksh
# Create and populate array of db syslog probes which are currently running
ps -ef | grep nco_p_syslog | grep -v grep | awk '{print $NF}' | awk -F. '{print $2}' > $OMNIHOME/bin/syslogfile.dat
set -A syslog_array
syslogfile_name='syslogfile.dat'
The results from the script in the dat file are....
Ok its fixed. The issue was that the script is so long I did not noticed that at the bottom this same dat file was being refilled so the old grep was replacing the new.