6 ms·
Here to plug using `--passthru`/`--passthrough`: it will print all lines, but highlight matches. I often do things like this to watch an output log, but highlig
by zellyn 9y ago
Here to plug using `--passthru`/`--passthrough`: it will print all lines, but highlight matches. I often do things like this to watch an output log, but highlight all entries with the string PLUGH in them:
tail -F output.log | ag --passthrough '.*PLUGH.*'
- CJefferson 9y agoI wondered what that option could be useful for, thanks!
- okdana 9y agoYou can achieve that in almost any of these tools (including old-school grep) by matching against something with zero width, like this: grep '^|.*PLUGH.*'
- petepete 9y agoYou could do that. Or you could just use --passthrough. It's easy to remember, easy to type, it autocompletes, it doesn't interfere with your criteria.
- whacker 9y agoThe equivalent in grep is '--line-buffered'.
- richardwhiuk 9y agohuh?
- whacker 9y agoI mean you can use grep as a filter for tail -f output.
- palotasb 9y agoThat's an orthogonal feature, it writes output after each line as opposed to every 4096 bytes, when the output is a pipe instead of a terminal. Useful when the other end of the pipe still goes to the terminal and you want to see it immediately. If `some-util-with-output` echoes stdin then without the option the following would not show you the latest grepped lines until the 4096 buffer fills. tail -F output.log | grep --line-buffered TEXT | some-util-with-output