Control: tag -1 + patch pending
Hi again
Axel Beckert wrote:
> The sole reason I use it over grep is that it supports multiline
> matches. It though seems that grep might be able to do that — albeit
> non-obviously — via "grep -Pzov", too.
Nope, even much simpler cases fail to remove just a substring from a
single line:
~ → printf 'foo\ngnarz\nbar\n' | fgrep -voz nar
~ → printf 'foo\ngnarz\nbar\n' | fgrep -ov nar
etc.
> Otherwise, I'll probably just use the original with "perl -E". It's
> just the build system trying to remove any unwanted crap (multiline
> <script> tags including their contents) from the generated HTML
> documentation.
The following change works and produces byte for byte the identical
result as "pcregrep -Mv", it's just a bit longer:
- pcregrep -Mv
'<script[^>]*>[^<]*</script>|<(form|input).*?>|</form>' | \
+ perl -E 'local $$/; my $$input=<>; $$input =~
s:<script[^>]*>[^<]*</script>\n*|<(form|input).*?>|</form>\n*::gsm; print
$$input;' | \
("$$" instead of "$" is needed even inside single quotes as this is
inside a Makefile where $ is a special character already.)
Regards, Axel
--
,''`. | Axel Beckert <[email protected]>, https://people.debian.org/~abe/
: :' : | Debian Developer, ftp.ch.debian.org Admin
`. `' | 4096R: 2517 B724 C5F6 CA99 5329 6E61 2FF9 CD59 6126 16B5
`- | 1024D: F067 EA27 26B9 C3FC 1486 202E C09E 1D89 9593 0EDE