News for hackers. Stuff that matters.
Re:Show HN: Tailspin – A Log File Highlighter by philo23 on Thursday November 02, 2023 @08:20AM (#38112479)
A little bit off topic, but I’ve always wanted a “simple” CLI tool that works exactly like grep (same flags and regex support), but rather than filtering the result, it just highlights the matches in the output.

I’ve not found anything like that yet though, closest I’ve come is using grep with the before/after/context flag with a high number of lines or using search in less, but I want to do something like...

    tail -f access.log | highlight ".jpg"
Maybe I’ve just not found the right flag for grep yet...
Re:Show HN: Tailspin – A Log File Highlighter by CubsFan1060 on Thursday November 02, 2023 @08:24AM (#38112523)
Try

| less -p ".jpg"

Re:Show HN: Tailspin – A Log File Highlighter by svedin on Thursday November 02, 2023 @09:01AM (#38112903)
ripgrep has a --passthru flag that does exactly this

  tail -f access.log | rg --passthru '\.jpg'
Re:Show HN: Tailspin – A Log File Highlighter by philo23 on Thursday November 02, 2023 @09:23AM (#38113170)
Brilliant, this looks like exactly what I want. I already use ripgrep a lot, so I should have guessed it had this feature already but wouldn't have known what to search for to find it! Thank you
Re:Show HN: Tailspin – A Log File Highlighter by jpitz on Thursday November 02, 2023 @03:19PM (#38118625)
As does ack
Re:Show HN: Tailspin – A Log File Highlighter by zem on Friday November 03, 2023 @01:46AM (#38124992)
I have that aliased to `hl` in my bashrc
Re:Show HN: Tailspin – A Log File Highlighter by loudmax on Thursday November 02, 2023 @09:11AM (#38113041)
This is how I colorize with grep:

  cat <file> | grep -E --color "<regex>|$"
Where `<regex>` is your pattern.
Re:Show HN: Tailspin – A Log File Highlighter by ralgozino on Thursday November 02, 2023 @09:28AM (#38113233)
adding "or an end of the line" to the regex is pretty clever, I'm stealing it :) thanks!
Re:Show HN: Tailspin – A Log File Highlighter by quickthrower2 on Friday November 03, 2023 @04:47AM (#38126071)
Obligatory “you don’t need cat”
Re:Show HN: Tailspin – A Log File Highlighter by jstanley on Thursday November 02, 2023 @09:35AM (#38113320)
I wrote this years ago: https://github.com/jes/emph
Re:Show HN: Tailspin – A Log File Highlighter by pdimitar on Thursday November 02, 2023 @02:22PM (#38117871)
A Markdown README and some screenshots will really help.