249
71
I use the --colour option of grep a lot, but I often use less as well. How can I pipe grep results to less and still preserve the coloring. (Or is that possible?)
grep "search-string" -R * --colour | less
EDIT:
I'm looking for a direct solution or anything equivalent to this.
possible duplicate of Get colors in 'less'' command
– Ciro Santilli 新疆改造中心法轮功六四事件 – 2014-09-19T08:07:24.517What does
*
do? From the man page of grep:*: The preceding item will be matched zero or more times.
But I still don't understand..! @JeremyPowell – Shayan – 2019-09-01T17:37:49.0631@Shayan, the '*' in this case is for the file arguments. It gets processed by the shell which expands it to all files in the directory. The search string is enclosed in double quotes in the example. – NeilG – 2019-11-02T04:15:46.717