Skip to content

Feature Suggestion: Limit length of output line #325

@jeffg-archive

Description

@jeffg-archive

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions