From 22f5ac8fcec4dbfcc1f5033f18bc4eeca52a747d Mon Sep 17 00:00:00 2001 From: Mitja Felicijan Date: Tue, 31 Oct 2023 08:20:22 +0100 Subject: Made the side more retro! --- public/grep-to-less-maintain-colors.html | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'public/grep-to-less-maintain-colors.html') diff --git a/public/grep-to-less-maintain-colors.html b/public/grep-to-less-maintain-colors.html index a3522a1..dcd4214 100755 --- a/public/grep-to-less-maintain-colors.html +++ b/public/grep-to-less-maintain-colors.html @@ -1,14 +1,17 @@ -Grep to Less that maintain colors

Grep to Less that maintain colors

note, May 29, 2023 on Mitja Felicijan's blog

I often use grep to search for todo's in my code and other people's code and then pipe them in less and I missed having colors that grep outputs in less.

  • Grep's --color=always use markers to highlight the matching strings.
  • Less's -R option outputs "raw" control characters.

You could use alias grep='grep --color=always' and alias less='less -R' or create todo function in your .bashrc that accepts first argument as search string.

# This is where the magic happens.
 grep --color=always -rni "TODO:" | less -R
-
Less and grep

Posts from blogs I follow around the net