sift icon indicating copy to clipboard operation
sift copied to clipboard

Shorter results with matches found inside long lines

Open indeed-a-genius opened this issue 8 years ago • 1 comments
trafficstars

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

indeed-a-genius avatar Aug 18 '17 13:08 indeed-a-genius

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.

svent avatar Aug 20 '17 23:08 svent