←back to thread

2039 points Gadiguibou | 2 comments | | HN request time: 0.459s | source
1. cancerhacker ◴[] No.36493802[source]
alias pbg='pbpaste | fgrep --color -i "`pbpaste -pboard find`"'

select all in a terminal window with pages of log data and cmd-c copy; find the one phrase you want to find in that data and cmd-e to put it in the find pasteboard; cmd-n new window, type pbg to isolate the log lines.

replies(1): >>36497425 #
2. philsnow ◴[] No.36497425[source]
TIL about named pasteboards https://developer.apple.com/documentation/appkit/nspasteboar...

I recognize that your pbg alias works for pretty much any text you could copy, but I wanted to mention, in case you're looking at log files with plain old less, there's the & limiter, which limits the current view to only lines matching a regular expression (or, if you type ^R during a & prompt, for a text match).

If you type ^N or ! during a & prompt it will limit the view to those lines that do not match the expression.

These view limits stack, so you can "&WARN<enter>" to see all lines that have WARN in them, and then maybe you want to see just a certain PID so "&12345<enter>" and you'll only see lines with both WARN and 12345, but then that one module is printing out a bunch of messages you think are safe to ignore so you do "&!modulename<enter>" and it filters out log lines that match modulename. Very handy and less is everywhere.