From cd6644ea4ddc78597934ab0ef5ba50e3c3daa927 Mon Sep 17 00:00:00 2001 From: Mitja Felicijan Date: Sat, 8 Jul 2023 23:25:41 +0200 Subject: Moved to a simpler SSG --- public/grep-to-less-maintain-colors.html | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 public/grep-to-less-maintain-colors.html (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 new file mode 100755 index 0000000..7278e7c --- /dev/null +++ b/public/grep-to-less-maintain-colors.html @@ -0,0 +1,16 @@ +Grep to Less that maintain colors

Grep to Less that maintain colors

May 29, 2023

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

\ No newline at end of file -- cgit v1.2.3