Skip to content

Instantly share code, notes, and snippets.

@rdp
Created December 3, 2018 17:22
Show Gist options
  • Save rdp/0286d91624930bd11d0169d6a6337c33 to your computer and use it in GitHub Desktop.
Save rdp/0286d91624930bd11d0169d6a6337c33 to your computer and use it in GitHub Desktop.
grep multiline perl test
$ cat ~/example.html
not it
<title>
yess 1
2
</title>
$ grep -P '(?s)<title>.*</title>' ~/example.html
$
@rdp
Copy link
Author

rdp commented Jan 20, 2022

$ grep -Pz '(?s)<title>.*</title>' ~/example.html
not it

<title> yess 1 2 </title>

Just beware -z adds a trailing NUL char to the output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment