4 ms·
My tips: 1) Fuck grep, use ripgrep, especially if you have to scour over an entire directory. 2) Get good with regex, seriously, it will shave hours off your
by Severian 4y ago
My tips:
1) Fuck grep, use ripgrep, especially if you have to scour over an entire directory.
2) Get good with regex, seriously, it will shave hours off your searching.
3) For whatever application you are using, get to know how the logging is created. Find the methods used where said logs are made, and understand why such a log line exists.
4) Get good with piping into awk if needed if you need some nice readable output.
- nerdponx 4y agoPiping into AWK feels like a misuse of the tool in all but the simplest of cases. Don't forget that you can write complete AWK scripts and invoke them from a file!
- jpitz 4y agoI use ack for this purpose, because the color filtering options are so good. https://beyondgrep.com/ https://beyondgrep.com/
- hayst4ck 4y agoEvery time I've done research (twice) ripgrep comes out on top. Usually it's something like rg > ag > ack > grep and that's overall testimonial, not just speed. What am I missing?
- jpitz 4y agoI started using ack about 14 years ago, so theres a lot of inertia there. It is slower than the others, but it was so much faster at the time for searching through source trees than grep. For log colorizing, I make use of the --color-match and --passthru arguments, like https://powdahound.com/2009/10/colorize-log-output-with-ack/ https://powdahound.com/2009/10/colorize-log-output-with-ack/
- burntsushi 4y agoFor log colorizing, here's the approximate equivalent of that blog post for ripgrep: cat UNLICENSE | rg --passthru --color always --colors 'match:fg:red' public | rg --passthru --color always --colors 'match:fg:green' heirs | rg --passthru --color always --colors 'match:fg:cyan' benefit