![]() |
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 |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| quick script C shell | ajp7701 | Shell Programming and Scripting | 1 | 03-18-2008 04:31 PM |
| Quick help needed in the Shell Script | namishtiwari | Shell Programming and Scripting | 1 | 02-01-2008 09:44 AM |
| need a quick basic shell script help | eb222 | Shell Programming and Scripting | 6 | 11-22-2007 09:00 AM |
| Quick Question | catbad | UNIX for Dummies Questions & Answers | 7 | 03-25-2003 07:01 PM |
| A Quick Question | DPAI | UNIX for Dummies Questions & Answers | 4 | 04-01-2002 06:02 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Quick Question on sed command in shell script
Hello,
I have the following line in one of my shell scripts. It works fine when the search string($SERACH_STR) exists in the logfile($ALERTLOG) but if the search string does not exist this line errors out at run time. Is there a way to make this line return 0 if it is not able to find the search string in the log file? START_LINE=`grep -n "$SEARCH_STR" $ALERTLOG | head -1 | sed 's/:/ /' | awk '{print $1}'` Thanks. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|