Format 'ps' command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Format 'ps' command
# 1  
Old 03-19-2013
Format 'ps' command

Hi all,

When I run the following command:
Code:
[oracle@all-dbrc01-s001 1]$ ps -ef|grep pmon

I get the following output:
Code:
oracle    2820 11817  0 12:09 pts/0    00:00:00 grep pmon
oracle   26906     1  0 Mar14 ?        00:00:43 ora_pmon_sat11cr1
oracle   26915     1  0 Mar14 ?        00:00:08 ora_pmon_sat11dm1

Is there a way to get the output formatted in the following way:
Code:
ora_pmon_sat11cr1
ora_pmon_sat11dm1

Thanks for any help in advance.

jd

Last edited by Franklin52; 03-19-2013 at 10:59 AM.. Reason: Please use code tags for data and code samples
# 2  
Old 03-19-2013
Code:
use "cut"  or ps -ef | grep pmon | awk '{ print $NF }'

# 3  
Old 03-19-2013

ps -ef | grep pmon | grep -v "grep pmon" | awk '{print $NF}'
# 4  
Old 03-19-2013
why grep with awk
try

Code:
ps -ef|awk '$NF ~ /ora_pmon_/ { print $NF } '

# 5  
Old 03-19-2013
Another method:
Code:
UNIX95= ps -eo args | grep [o]ra_pmon

Or use pgrep
Code:
pgrep -l ora_pmon | cut -d" " -f2


Last edited by Yoda; 03-19-2013 at 10:25 AM.. Reason: added pgrep
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need command for date format

hi all, i had a requirement in my script iam passing the parameter like (its not the system date iam passing as argument like it can be any date) 2014-08-25 but in my output file it should be 08/25/2014 please guide me thanks in advance hemanthsaikumar (3 Replies)
Discussion started by: hemanthsaikumar
3 Replies

2. Shell Programming and Scripting

Date command format

Hi, I need to convert a date format "August 12, 2013 9:40:00 PM CDT" in to DD/MM formant For example ..I am using ... date -d "January10, 2013 04:05:00 AM CST" +%m/%d which gives me... 01/10 However, when i'am using it against every month it is throwing errors on some months as... (3 Replies)
Discussion started by: Kevin Tivoli
3 Replies

3. Shell Programming and Scripting

How to format output of command?

Hi how do you change the format of the output of ls -lt -c -R $HOME | sed /^total/d From: /home/pikamon/Desktop: -rwxr-xr-x 1 pikamon pikamon 35 Sep 18 14:25 fileModified.sh -rwxr-xr-x 1 pikamon pikamon 87 Sep 18 14:25 fileModified.sh~ /home/darksky21/Downloads: -rwxrw-rw- 1 pikamon... (5 Replies)
Discussion started by: pikamon
5 Replies

4. Shell Programming and Scripting

How to change date format in 'last' command?

hi.. i am new to here. can anybody tell me how can we change the date format in the 'last' command. EX- on running last command i am getting -- rruat pts/12 172.18.40.101 Tue May 3 12:59 still logged in rruat pts/10 blr2-3f-239.asco Tue May 3 12:59 - 13:09 ... (2 Replies)
Discussion started by: thearpit
2 Replies

5. Shell Programming and Scripting

format a read command

I have a read command like this: print "enter the time to recover to: \n" print "please use the format dd-mon-rrrr hh24:mi:ss" read -n $dbtime How do I format/check the read command to force the desired date/time format I want? (4 Replies)
Discussion started by: djehresmann
4 Replies

6. HP-UX

Date format of ll command

Hi, Unix: HP-UNIX. I have a requirement(part of my requirement) to get latest file modification date of all files(In a particular directory). Using ll comand i m able to find out the modification date but not in the required format My command and out put: echo trp_pb.sql `ll... (2 Replies)
Discussion started by: satyadash
2 Replies

7. Shell Programming and Scripting

awk command format ?

Can some body tell me the meaning of '$1=$1' in the following syntax. nawk -v RS='' -v OFS=',' '$1=$1' myFile.txt Thanks, Mahesh :) (4 Replies)
Discussion started by: maheshsri
4 Replies

8. Shell Programming and Scripting

ls command format display

Hi I have 3 files $ ls -l -rw-r--r-- 1 osbadmin osbadmin 427701 Apr 22 12:06 SANITY_TEST -rw-r--r-- 1 osbadmin osbadmin 427701 Apr 22 12:06 Success 123333 -rw-r--r-- 1 osbadmin osbadmin 427701 Apr 22 12:06 Success 123333 (1) I need to see this "SANITY_TEST" "Success 123333" "Success... (6 Replies)
Discussion started by: mnmonu
6 Replies

9. Shell Programming and Scripting

how to format a grep command

Hello I am trying to use the grap command to locate the following phrase in a file: "file.php\tDebug: one two three" Note that \t denotes a tab (whitespace) and not the characters \ and t I am encountering the following 2 problems: 1) there is a perido between "file" and "php" which... (2 Replies)
Discussion started by: jasongr
2 Replies

10. UNIX for Dummies Questions & Answers

Format Command

The reason I cannot install the Software Companion CD is that I have a hardrive that is 10GB. On my root slice/partition there is allocated 900MB, on my /export/home slice I have 8GB for use (these values were set by default on install). The software companion tries to install 600MB into my /opt... (2 Replies)
Discussion started by: yestoprop69
2 Replies
Login or Register to Ask a Question