I'm using grep to find a string in a file. The grep will probably only find one file that matches the file name, possibly two, but i only need it to put the string if it found it, and just the string.
grep -oh 'Closing finished' /opt/cpu/hold/closing15{14..23}
Currently i get an output like:
grep: /opt/cpu/hold/closing1514: No such file or directory
Closing finished
Closing finished
grep: /opt/cpu/hold/closing1517: No such file or directory
grep: /opt/cpu/hold/closing1518: No such file or directory
I'm using this in a function in a bash script, in an until loop to match "Closing finished" before moving on. So i want the output to just be "Closing finished" if found so it matches my until condition.