Imagine you want to grep recursively for string1
but not string1_suffix
. Trivial approach would be
grep -r string1 | grep -v string1_suffix`
But what if the file names can contain string1_suffix
?
A line containing string1_suffix_data.json: blabla string1
would be filtered away by the second grep.
Is it possible to circumvent this somehow? Of course in this trivial example I could just turn around the first and the second part, but what about the general case?