![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Jumpstart Issues Solaris 10 | soupbone38 | SUN Solaris | 7 | 12-08-2008 05:41 AM |
| Script works on Solaris, not on Linux | Silverhood | Shell Programming and Scripting | 1 | 10-05-2007 09:52 AM |
| Script works on Solaris, not on Linux | Silverhood | Shell Programming and Scripting | 0 | 10-05-2007 09:27 AM |
| Samba 3.0.14 on Solaris 10 issues | Sapna | SUN Solaris | 0 | 10-10-2005 02:21 PM |
| Solaris boot issues | xyyz | UNIX for Advanced & Expert Users | 6 | 02-14-2003 02:36 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Solaris / Linux Issues with script
Hello,
I run this command from a solaris box and it works just fine. It gives me the kind of output in my file I am looking for which would be for example... sb1p rdop ot2p ot3p eimp However when I do the same thing from a Linux box... ps -ef | grep nco_p_syslog | grep -v grep | awk '{print $NF}' | awk -F. '{print $1}' > $OMNIHOME/bin/syslogfile.dat I get this in the file... /lcl/apps/Tivoli/netcool/omnibus/probes/linux2x86/syslog Both are using #!/bin/ksh I have no idea where it is even getting that long directory path from for the results. Any ideas? Thanks in advance. |
|
||||
|
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. |
|
||||
|
Ok I have been trying that and did some reading up on awk however I can not seem to find how to only capture the last part.
Currently I do... Code:
ps -ef | grep nco_p_syslog | grep -v grep | awk '{print $NF}' | awk -F. '{print $1}' > $OMNIHOME/bin/syslogfile.dat
Code:
/lcl/prd/data/dc000p/dump/bdump/alert_dc000p 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. |
|
||||
|
I am sooo close!!!
I am now doing this... Code:
ps -ef | grep nco_p_syslog | grep -v grep | awk '{print $NF}' | awk -F_ '{print $2}' >> $OMNIHOME/bin/syslogfile.dat
Code:
dc000p.log |
|
||||
|
Without trying very hard:
ps -ef | grep nco_p_syslog | grep -v grep | awk '{print $NF}' | awk -F_ '{print $2}' | cut -d '.' -f 1 Maybe? I don't have your output. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|