Say I've got some documents that contain several lines with KEYWORD
and some lines with PREFIX_KEYWORD
.
How would I match only these lines that have KEYWORD
and ignore the lines that have PREFIX_KEYWORD
on them?
Yes, I could grep for KEYWORD
, feed the results into the editor of my choice and let the editor delete all lines that have PREFIX_KEYWORD
but I'm asking whether there's a built-in way in grep to do this.
If this helps: I'm not interested in the exact match but only want to know whether there are occurrences of KEYWORD
in the file.