I would like to find lines in files with the appearance of some pattern and the absence of any other pattern. For example, I need to find all files / lines, including loom , except those that have gloom . So, I can find loom with the command:
grep -n 'loom' ~/projects/**/trunk/src*.@(h|cpp)
Now I want to search for loom except gloom . However, both of the following commands were not executed:
grep -v 'gloom' -n 'loom' ~/projects/**/trunk/src*.@(h|cpp) grep -n 'loom' -v 'gloom' ~/projects/**/trunk/src*.@(h|cpp)
What should I do to achieve my goal?
EDIT 1: I mean that loom and gloom are sequences of characters (not necessarily words). Therefore, I need, for example, bloomberg to output the command and not need ungloomy .
EDIT 2: There is an example of my expectations. Both of the following lines are in command output:
I came across icons that loomed through the veil of incense.
Artie falls asleep on a gloomy day.
Both of the following lines are not output by the command:
Its terrible marble horror - the great tricks of o cloods.
In the southwestern circle of the hip paint hall
bash grep
Loom Aug 27 '13 at 14:47 2013-08-27 14:47
source share