From 1100562e29f6476448b656dbddd4cf22505523f6 Mon Sep 17 00:00:00 2001 From: Mitja Felicijan Date: Sun, 10 Mar 2024 14:59:14 +0100 Subject: Move back to JBMAFP --- .../2023-05-29-grep-to-less-maintain-colors.md | 26 ---------------------- 1 file changed, 26 deletions(-) delete mode 100644 _posts/notes/2023-05-29-grep-to-less-maintain-colors.md (limited to '_posts/notes/2023-05-29-grep-to-less-maintain-colors.md') diff --git a/_posts/notes/2023-05-29-grep-to-less-maintain-colors.md b/_posts/notes/2023-05-29-grep-to-less-maintain-colors.md deleted file mode 100644 index b1421b9..0000000 --- a/_posts/notes/2023-05-29-grep-to-less-maintain-colors.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: "Grep to Less that maintain colors" -permalink: /grep-to-less-maintain-colors.html -date: 2023-05-29T21:27:07+02:00 -layout: post -type: note -draft: false -tags: [bash] ---- - -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. - -```sh -# This is where the magic happens. -grep --color=always -rni "TODO:" | less -R -``` - -![Less and grep](/assets/notes/grep-less.png){:loading="lazy"} -- cgit v1.2.3