Tip: if your grep
outputs colour, the command is aliased to something like grep --color=auto
. You can check with the alias
command.
There's nothing wrong with that, until you start using pipe (|
) to use grep
's output in other commands. The --color
switch adds ANSI characters for colour and this can have unexpected results.
To be safe, unset the alias (check ~/.bashrc
, ~/.profile
or one of the other files that's sourced on login) or run \grep
. The \
in front of it will run the actual command, not the aliased command.
nice tip ,thank you @slash-es