![]() |
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 |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How do I search a File for a string exact match | CAGIRL | Shell Programming and Scripting | 3 | 07-29-2008 01:20 AM |
| search excat string in another string (grep "fails") | bora99 | UNIX for Dummies Questions & Answers | 0 | 06-05-2008 06:41 AM |
| grep for a search string | raga | UNIX for Dummies Questions & Answers | 11 | 03-12-2008 08:38 AM |
| grep: RE error 41: No remembered search string. | fkaba81 | Shell Programming and Scripting | 2 | 06-22-2006 02:23 AM |
| sed, grep, awk, regex -- extracting a matched substring from a file/string | ropers | Shell Programming and Scripting | 2 | 05-23-2006 01:56 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hi All,
I have 2 programs running by the following names: a_testloop.sh testloop.sh I read these programs names from a file and store each of them into a variable called $program. On the completion of the above programs i should send an email. When i use grep with ps to see if any of these are running i cannot differentiate between the two. I am using the following command: ps -ef|grep $program|grep -v grep The above command succeeds for both the cases even when only a_testloop.sh is running as testloop.sh is a part of a_testloop.sh. I want to grep/search only the exact string not substring. Please help. Thanks, Albert |
|
||||
|
The ps-output is tabular, right?
You can search for whitespace too, if you protect them properly (otherwise the shell will eat them): Code:
# cat myfile testloop a_testloop # grep '[<spc><tab>]testloop' myfile testloop # grep '[<spc><tab>]a_testloop' myfile a_testloop I hope this helps. bakunin |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|