Post AQ8lBPDiOK6NAAScoC by otherpaco@chaos.social
(DIR) More posts by otherpaco@chaos.social
(DIR) Post #AQ5qHunzmumj9mTSYS by _xhr_@cybervillains.com
2022-11-29T10:31:33Z
9 likes, 13 repeats
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.
(DIR) Post #AQ5qHvLJn1RKp844Ui by wolf480pl@mstdn.io
2022-11-29T10:36:46Z
2 likes, 0 repeats
@_xhr_ I ususally use grep to filter text streams, but when I don't, it's because I want to see the surrounding non-matching lines, so slash search (/) in less is much more useful to me
(DIR) Post #AQ7ezsUOwx3Za7QRkG by fxdc@teh.entar.net
2022-11-30T07:33:27Z
1 likes, 0 repeats
@_xhr_ @jess here's another good one: you can type command-line switches into less while it's running
(DIR) Post #AQ8lBPDiOK6NAAScoC by otherpaco@chaos.social
2022-11-30T20:22:45Z
0 likes, 0 repeats
@wolf480pl @_xhr_ you can use grep with -A and -B to specify the number of lines to show -A after and -B before the matching line(s)
(DIR) Post #AQ8p0dB6YVFZ5GMDiq by wolf480pl@mstdn.io
2022-11-30T21:06:35Z
0 likes, 0 repeats
@otherpaco @_xhr_ yes, but that requires knowing the number of lines in advance. Which can be very unpredictable when reading logs of software you didn't write yourself.
(DIR) Post #AQ93Hp5iukryJTvrrk by AndreasEK@ruhr.social
2022-11-30T23:46:31Z
0 likes, 0 repeats
@wolf480pl @_xhr_ I think it was the '-C n' parameter that told grep to output n lines before and after a match
(DIR) Post #AQ95EJJqmmiGoTzcyu by wolf480pl@mstdn.io
2022-12-01T00:08:19Z
0 likes, 0 repeats
@AndreasEK @_xhr_ yes, but that requires knowing ahead if time how many lines you need. Which you usually don't know when looking through logs for a problrm that you're seeing for the first time.