beyondgrep / ack2

**ack 2 is no longer being maintained. ack 3 is the latest version.**
https://github.com/beyondgrep/ack3/
Other
1.48k stars 138 forks source link

Feature request: single-line files just report match or not, if they are big #345

Closed hoelzro closed 7 years ago

hoelzro commented 11 years ago

https://github.com/petdance/ack/issues/159

Various programs produce text files all on a single line. These files can be quite big. If you search them with ack and it finds a match, then it prints the whole file contents.

If a file has just a single line and that line is more than, say, 1000 characters long, then ack should suppress its normal printout of matching lines and just say 'Single-line text file X matches'.

hoelzro commented 11 years ago

See also #357.

petdance commented 11 years ago

@epa: Do you have a use case for this other than minified Javascript files?

epa commented 11 years ago

There are usually a few files lying around which have extremely long lines, being trace logs or data dumps from various scripts. For example one program I use produces log files with big strings of base64 encoded data. Perhaps not every 'ack' command matches one of these huge lines, but when it does, the output produced swamps the other matches.

So I might modify my initial request and suggest instead that extremely long lines should (by default) be suppressed in ack's output, printing instead 'match found at extremely long line 123 of file foo' or something like that. IMHO, this is similar to the treatment of binary files, where you try to be kind to the user's console by not printing them verbatim.

epa commented 9 years ago

FWIW, there are quite a lot of tools which produce one-line text files by default. Lots of XML data files are like that for example. HTML can be too.

pdl commented 9 years ago

Not the same but similar use case: https://github.com/petdance/ack2/issues/366

petdance commented 7 years ago

We should organize all the "How do we handle long lines?" issues into one. Probably it won't get done until ack3.

petdance commented 7 years ago

Closed and moved to wiki.