linux - [Solved-4 Solutions] How to search for a multiline pattern in a file ? - ubuntu - red hat - debian - linux server - linux pc
Linux - Problem :
How to search for a multiline pattern in a file ?
Linux - Solution 1:
For example, you need to find files where the '_name' variable is immediatelly followed by the '_description' variable:
Tip: you need to include the line break character in your pattern. Depending on your platform, it could be '\n', \r', '\r\n', ..
Linux - Solution 2:
Linux - Solution 3:
Linux - Solution 4:
grep -P also uses libpcre, but is much more widely installed. To find a complete title section of an html document, even if it spans multiple lines, you can use this:
Since the PCRE project implements to the perl standard, use the perl documentation for reference: