- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How to find exact string match
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2000 12:33 PM
12-28-2000 12:33 PM
Here is my requirement.
I am running "ps -ef" command and I need to filter out ONLY a required process information. For example, I need to filter out "man" process details.
If I use grep to do this job, it filters out man process information along with other strings contain this pattern ( eg., manager ).
I don't want any of these unnecessary outputs. I need only process information about man process. How to do it?
Thanks in advance.
With warm regards,
Jegi,
NBC
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2000 01:15 PM
12-28-2000 01:15 PM
Re: How to find exact string match
What you might be able to do is grep for what you want and then pipe down to eliminate what you don't want. This will be difficult to set up for because (at least here...) different processes may start running that you hadn't accounted for....but...
ps -ef | grep man | grep -v -e 'manager' -v -e 'management' -v -e 'managed' and so forth...
Just a thought,
rcw
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2000 01:43 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2000 02:02 PM
12-28-2000 02:02 PM
Re: How to find exact string match
Richards reply gave me an idea. Here is what i did and got what i needed.
1) ps -ef|grep man > /tmp/ps.out
2) vi /tmp/ps.out
3) navigate through the file to identify what kind of character( whether white space or TAB) preceeds and succeeds "man" entry.
4) found process name is preceeded by white space and succeeded by NOTHING.
5) run ps -ef|gre ' man' and obtained desired output.
Thanks a lot
Regards,
Jegi,
NBC
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2000 02:09 PM
12-28-2000 02:09 PM
Re: How to find exact string match
Procedure i mentioned earlier may not work at all the times. But using white space surely gives a hand in searching for exact string (awk might assist to attain desired result)
Thanks
Jegi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2000 06:48 PM
12-28-2000 06:48 PM
Re: How to find exact string match
For example:
Show just the process ID, the memory used and the command (ie, process name) without any leading directories:
UNIX95= ps -e -o 'pid,vsz,comm'
This makes parsing much easier.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2000 09:51 PM
12-28-2000 09:51 PM
Re: How to find exact string match
If you put the following lines in a script and make it executable, it would save you retyping the full stuff every time.
#!/usr/bin/sh
# get process entry for name given as argument
ps -ef | sed -n "/[[:space:]]$1[[:space:]]*/p"
It is using the regular expression [[:space:]] to allow for non printable characters around your word.
Best regards,
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2001 12:36 AM
02-01-2001 12:36 AM
Re: How to find exact string match
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2001 10:11 AM
02-01-2001 10:11 AM
Re: How to find exact string match
Learn something new everyday!!!
Thanks,
jcd