The first line wasadmin 5935 54288 0 12:39 pts/8 00:00:00 grep java is NOT a actual process it is a process of the command itself, so if you do the following command it shoult not come then.
Now if we want to get output for ccos2104Cell ccos2104 aa then following may help.
On a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk , /usr/xpg6/bin/awk , or nawk. Hope this helps.
Thanks,
R. Singh
Last edited by rbatte1; 03-05-2015 at 12:16 PM..
Reason: Added suggestion for awk oin SunOS and solaris system
I'm confused a little. perhaps some good practice will help you whilst I try to work out what you need.
If you change your command to be ps -ef | grep jav[a] then you will only get the header and any real java processes, i.e. your grep will be excluded. If you want just a few columns from that very wide output, consider the -o formatting flag for the command instead, perhaps something like this will meet your needs if you are sure that these is just one real java process:-
I hope that this helps,
Robin
Hi all i have a syntax , Can some one please give me a script
1, I need to check and execute the command.
ps -ef | grep java | wc -l
5
Output should me 5
if not have to run the command:
ps -ef | grep java
the following java process... (11 Replies)