https://stackoverflow.com/questions/18315380/invisible-0131-number-in-bash
$ echo 1 2 3 | grep 2
1 2 3
$ echo 1 2 3 | grep 2 | cat -v
1 2 3
$ echo 1 2 3 | grep --colour=always 2
1 2 3
$ echo 1 2 3 | grep --colour=always 2 | cat -v
1 ^[[01;31m^[[K2^[[m^[[K 3
The solution is to use
--colour=auto
or not use the --colour
option at all.
$ echo 1 2 3 | grep --colour=auto 2
1 2 3
$ echo 1 2 3 | grep --colour=auto 2 | cat -v
1 2 3
Check your .bashrc to see if you set alias grep='grep --colour=always' like I did.
No comments:
Post a Comment