I'm currently sifting through a lot of unfamiliar logs looking for some issues. The first file I look at is Events.log, and I get at least three pages in less which appear to display the same event at different times – an event that appears to be fairly benign.
I would like to filter this event out, and currently I quit less and do something like
grep -v "event text" Events.log | less
This now brings a number of other common, uninteresting events that I would also like to filter out. Is there a way I can grep -v inside of less? Rather than having to do
egrep -v "event text|something else|the other thing|foo|bar" Events.log | less
It strikes me as a useful feature when looking at any kind of log file – and if less isn't the tool, is there another with the qualities I seek? Just a less-style viewer with built in grep.
less, using '&!<1stpattern>' allows me to 'hide' lines with a pattern on, however it only applies to one pattern at a time, so if I find a second pattern and apply '&!<2ndpattern>', lines that matched the first pattern and were hidden, are now visible. So very close! – forquare Jan 15 '15 at 11:19&!and then press an arrow key. – PM 2Ring Jan 15 '15 at 11:34less; I don't know if it's preserved after rebooting, though. – PM 2Ring Jan 15 '15 at 11:40~/.lesshst. And yes, just group patterns just like you would in grep. – orion Jan 15 '15 at 11:41grep foo | grep -v bar | less. – 300D7309EF17 Jan 19 '15 at 22:34&pattern, is there a way to keep it when invokingshift ffollow? – Josh Hibschman Feb 12 '24 at 13:52