Add pcre2grep and a category for "does it match across multiple lines?"
As far as I know no other grep implementation can do this:
$ ./pcre2grep -M 'Copyright(\n|.)*Copying' INSTALL
Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software
Foundation, Inc.
Copying and distribution of this file, with or without modification,
What is that doing? Multi-line match?
Yes, stand-alone example:
$ (echo foo; echo bar; echo baz) >file ; ./pcre2grep 'foo.*baz' file; echo $?
1
$ (echo foo; echo bar; echo baz) >file ; ./pcre2grep -M 'foo.*baz' file; echo $?
1
$ (echo foo; echo bar; echo baz) >file ; ./pcre2grep -M 'foo(.|\n)*baz' file; echo $?
foo
bar
baz
0
I'm now aware of another grep-like tool that does this.
The silver search does this (by default, nonetheless). ripgrep will also have this soon too.
XREF
-
**pcre2grep**is a follow on to thepcregrep, added in #48 ; - was mentioned as being Unicode compatible in https://github.com/beyondgrep/ack3/issues/349#issuecomment-1148117205
- Multi-line capability, adding of to Ack3, is requested in https://github.com/beyondgrep/ack3/issues/171
As far as I know no other grep implementation can do this:
<pedantic> **paragrep** is already listed on the More Tools page as a multiline grep, that's what it's specifically good for.
It wouldn't by default span over the whitespace line paragraph break, but has argument to select a different End of Paragraph RE, so there was at least one already listed.
</pedantic>
That said, Multiline/Paragraph modes would be worthy of adding a capability in the comparison table, especially with the list now being at least 4: paragrep pcre2grep ag=Silver, and presumably ripgrep since it was "soon" in 2018.
We might need to split into 2 tickets, one for More Tools and one for Comparison Table ?