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}'`