-
Notifications
You must be signed in to change notification settings - Fork 70
Open
Labels
Description
I search repos that contain large, machine-generated JSON files (single line 500k file, for example). If these files contain my search pattern, the output spams my terminal with the full file contents.
I want to do something equivalent to this, but natively in ack (preserving ack's formatting):
$ ack <pattern> | cut -b 1-200
path/to/file1:124: blah blah pattern
path/to/file2:7: pattern blah blah blah blah blah ... <truncated>
For example, this imaginary option:
$ ack --max-line-length 200 <pattern>
path/to/file1
124: blah blah pattern
path/to/file2
7: pattern blah blah blah blah blah ... <truncated>
For reference, see this stackexchange question and answers: https://unix.stackexchange.com/questions/163726/limit-grep-context-to-n-characters-on-line
Reactions are currently unavailable