Banging My Head Against Grep Wall
I'm trying to filter lines out of a log within a shell script, with line like this...
cat log | grep -v "filter word" | grep -v "filter 2" > newLog
...but I cannot find the grep or egrep command for something slightly more complex than a simple match.
I want to exclude (delete) all lines ending with "/" EXCEPT if they begin with "deleting".
So a file which contains these 4 lines...
this gets through
deleting - this gets through/
deleting - this gets through
this does NOT get through/
...will result in this...
this gets through
deleting - this gets through/
deleting - this gets through
Thanks very much for any pointers. Maybe I shouldn't be trying it with just grep?
cat log | grep -v "filter word" | grep -v "filter 2" > newLog
...but I cannot find the grep or egrep command for something slightly more complex than a simple match.
I want to exclude (delete) all lines ending with "/" EXCEPT if they begin with "deleting".
So a file which contains these 4 lines...
this gets through
deleting - this gets through/
deleting - this gets through
this does NOT get through/
...will result in this...
this gets through
deleting - this gets through/
deleting - this gets through
Thanks very much for any pointers. Maybe I shouldn't be trying it with just grep?