I have the text, that contains some lines. So, i need to make GREP of several lines. For example, i have repeating text and i should GREP get lines, that have this repeating key-words.
grep -o "test|test2" textfile
My text:
123|never for your|test
123421|never for your|test2
123412|never for your|test3
12341|never for your|test4
12311|never for your|test2
123312312|never for your|test
123321312|never for your|test2
I should have:
123|never for your|test
123421|never for your|test2
123312312|never for your|test
123321312|never for your|test2
It works, but it doesn't work how i want. It searchs in text, all words "test" & "test2". But i want to get textblocks, like some pattern, where only after "test" comes "test2". Have you got any ideas ?