Is there any way of using grep (this may be done in awk, not sure?) that I can stop grep'n a file once I have found the first occurrence of my search string. Looking through grep man pages
-q will exit without printing the lines after the first match, but I need the output.
I have looked at awk but am not finding what i require.
You could pipe the results of your grep through head, it would look something like this:
grep <patern> <file> | head -1
if your file is incredibley large this may not be what you want, but if all you want to know is the first thing that grep found, and time wont be an issue, then this may be the most simple...