![]() |
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 to negate grep result? | mmdawg | Shell Programming and Scripting | 4 | 05-05-2008 08:24 AM |
| diaplaying the grep result | rag84dec | Shell Programming and Scripting | 1 | 03-27-2008 02:37 AM |
| append a string to a grep result | melanie_pfefer | Shell Programming and Scripting | 8 | 03-19-2008 07:19 AM |
| grep to handle a 0 result | ocelot | UNIX for Dummies Questions & Answers | 6 | 02-05-2007 11:19 AM |
| is there any why to get the number of line in grep result ? | umen | UNIX for Dummies Questions & Answers | 1 | 03-16-2006 09:56 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
To have a numeric result from grep
I am new to unix. i need to know how to use grep to grep and expression from a file. and pass the result as a 0 for found and 1 for not found. I can only go up to grep 'Checking Subscription Status' ranos.log. Please help. Thank you.
|
|
|||||
|
You don't have to worry about converting the result into 0 for found and 1 otherwise. The shell takes care of this for you.
Check the status like this: Code:
grep 'Checking Subscription Status' ranos.log > /dev/null if [ $? -eq 0 ]; then echo success! else echo failure!! fi |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|