bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#44983: Truncate long lines of grep output


From: Juri Linkov
Subject: bug#44983: Truncate long lines of grep output
Date: Thu, 10 Dec 2020 10:06:53 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

> Also see this:
> ,----
> | grep -oE '.{0,20}jQuery.{0,20}' bootstrap.min.js
> `----

But what if the user enters such a regexp as "abc|xyz",
then it will be composed into such command:

  grep -oE '.{0,20}abc|xyz.{0,20}'

that matches either 20 characters before "abc", or 20 characters
after "xyz".  Then needs to add parentheses:

  grep -oE '.{0,20}(abc|xyz).{0,20}'

What is worse is that the whole match is highlighted,
including 20 characters before and after the real match.
So it seems this solution is not perfect.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]