sift
sift copied to clipboard
Shorter results with matches found inside long lines
I'd like an option to limit the NUM of characters surrounding the match in the results.
For example, currently when I'm searching for "123" inside a file:
qwerty qwertyqwerty qwerty qwertyqwerty qwertyqwertyqwerty 123 qwerty qwerty qwertyqwerty qwerty
the result always displays the whole line from the beginning to the end, making the result long.
qwerty qwertyqwerty qwerty qwertyqwerty qwertyqwertyqwerty 123 qwerty qwerty qwertyqwerty qwerty
With the option, if I set let's say context-chars=10 I'd like to get:
rtyqwerty 123 qwerty qw
The option --output-limit doesn't help because it doesn't take the match's position into the account
Thanks for the suggestion - I had the same problem in the past and will look into it.
I am currently thinking about an option like --output-context that would be similar to --output-limit but work like you suggested.