How to give a pattern for new line in grep? New line at beginning, new line at end. Not the regular expression way. Something like .
try pcregrep instead of regular grep:
pcregrep
grep
pcregrep -M "pattern1.* .*pattern2" filename
the -M option allows it to match across multiple lines, so you can search for newlines as .
-M
2.1m questions
2.1m answers
60 comments
57.0k users