Wow, after 25 years of Unix experience, I learned that you can filter output in #less.
Press ampersand (&) and enter a regex to show only lines matching the regex.
Press ampersand (&) and then exclamation mark (!) to apply an inverse filter.
Wow, after 25 years of Unix experience, I learned that you can filter output in #less.
Press ampersand (&) and enter a regex to show only lines matching the regex.
Press ampersand (&) and then exclamation mark (!) to apply an inverse filter.
@wolf480pl For grep, consider using the -C switch (context):
-C NUM, -NUM, --context=NUMPrint NUM lines of output context. Places a line containing a group separator (--) between contiguous groups of matches. With the -o or --only-matching option, this has no effect and a warning is given.@xhr@cybervillains.com
Also:
/ = search forward
? = search backward
Didn't know the & trick TBH, good one :-)
@_xhr_ woaaaaa, and it does chain!
No more daisy chains of greps, pipes and less at the end o_0
Bunch of future life-years of piping and greping reclaimed for other uses!
Thanks!
@KasTasMykolas Is there a way to undo them? The last one, single ones, or at least all of them?
@_xhr_ by the way, for Your defence, it may be not so old addition. For now I can find it crawling into FreeBSD codebase somewhere between 7.3.0 and 7.40:
https://github.com/dspinellis/unix-history-repo/blob/FreeBSD-release/7.4.0/contrib/less/less.man#L260-L274
So, at least 10-11 years ago.
@_xhr_ TIL!
BTW, another neat function (at least in the GNU version?) is pressing Shift-F to make it follow the file (scroll to the end and update when the file changes) - useful for logs!
It's incredibly slow unfortunately :(
I use https://github.com/tigrawap/slit/releases as a much nicer less alternative, with many more features:
See its readme: https://github.com/tigrawap/slit#readme