|
grep to handle a 0 result
Hi guys,
I have the following grep command in a script to search through a file for a string and return its count, and it works fine for when the string exists:
grep "string" file.txt | wc
However, sometimes the result will be 0 and I want the script to take this as the result. Right now it is just dumping out with a "child process exited abnormally"
How can I get around this so that if the result is 0 then the script doesnt dump out and takes the result as 0?
thanks
|