grep
uses --color=always
to preserve colors in a piped output. But this doesn't work in ack-grep
, what is the ack
equivalent?
Asked
Active
Viewed 28 times
1

Cyrus
- 84,225
- 14
- 89
- 153

Patoshi パトシ
- 21,707
- 5
- 29
- 47
-
1Have you tried just `ack --color`? According to the documentation, this should do it. – gepa Jan 17 '23 at 18:26
-
--color doesn't work. i just did a "ls | ack xxx" and the only thing in color is the matched pattern. the other letters are not blue, the default color if i do a ls. – Patoshi パトシ Jan 17 '23 at 18:32
-
Well, that has to do with ls, that behaves similarly if the output is piped. You get the same if you do `ls | grep --color=always`, also only colors for the matched patterns. Actually I am correcting myself, you could do `ls --color=always | grep/ack`, then `grep/ack` does indeed get colored input, but they still both behave the same and ignore the input color and generate color for the match only. – gepa Jan 17 '23 at 18:57