The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 04-22-2009
LRoberts LRoberts is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 87
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
Which gives the results of....
Code:
/lcl/prd/data/dc000p/dump/bdump/alert_dc000p
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.