diff options
Diffstat (limited to 'content/notes/grep-to-less-maintain-colors.md')
| -rw-r--r-- | content/notes/grep-to-less-maintain-colors.md | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/content/notes/grep-to-less-maintain-colors.md b/content/notes/grep-to-less-maintain-colors.md index 9b797ee..6df2761 100644 --- a/content/notes/grep-to-less-maintain-colors.md +++ b/content/notes/grep-to-less-maintain-colors.md | |||
| @@ -7,16 +7,15 @@ draft: false | |||
| 7 | tags: [bash] | 7 | tags: [bash] |
| 8 | --- | 8 | --- |
| 9 | 9 | ||
| 10 | I often use `grep` to search for todo's in my code and other people's | 10 | I often use `grep` to search for todo's in my code and other people's code and |
| 11 | code and then pipe them in `less` and I missed having colors that grep | 11 | then pipe them in `less` and I missed having colors that grep outputs in `less`. |
| 12 | outputs in `less`. | ||
| 13 | 12 | ||
| 14 | - Grep's `--color=always` use markers to highlight the matching strings. | 13 | - Grep's `--color=always` use markers to highlight the matching strings. |
| 15 | - Less's `-R` option outputs "raw" control characters. | 14 | - Less's `-R` option outputs "raw" control characters. |
| 16 | 15 | ||
| 17 | You could use `alias grep='grep --color=always'` and `alias less='less | 16 | You could use `alias grep='grep --color=always'` and `alias less='less -R'` or |
| 18 | -R'` or create todo function in your `.bashrc` that accepts first argument | 17 | create todo function in your `.bashrc` that accepts first argument as search |
| 19 | as search string. | 18 | string. |
| 20 | 19 | ||
| 21 | ```sh | 20 | ```sh |
| 22 | # This is where the magic happens. | 21 | # This is where the magic happens. |
