Subject: bug#44983: Truncate long lines of grep output

From: Jean Louis <[email-masked]>
Date: Thu, 10 Dec 2020 13:08:10 +0300

* Juri Linkov <[email-masked]> [2020-12-10 11:34]:
> > 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}'

I do not find it problematic. Grep is anyway kind of advanced tool. I
think that Emacs "Search for files (grep)" menu option is anyway not
user friendly. It is made for those who know what is GNU/Linux, UNIX,
BSD. When user is faced with that option most probably will give up
soon in using it. Because the prompt asks user to enter something like:

grep --color -nH --null -e

but does not tell the user what it means, neither that one has to put
joker or file names after the term. Usability is degraded as the
function is only for advanced users there. Majority of GNU/Linux users
use GUI for any work.

In that sense advanced users should know how to use grep to at least
get results they need and want.  You put good intentions to beautify
the grep output.  But it is probably not necessary. They will not mind
of highlighting. They can do:

grep -nH --null -e

And there will be no highlighting. It gives the result. 

What would be more user friendly would be a form or wizard that would
specify if all files are to be searched or recursively, and what would
be the search term. That would degrade power of grep but it would be
more user friendly to many people.

In my opinion I believe that majority of users who ever clicked
"Search Files (grep)" gave up after few attempts.