Grep command output displays highlighted characters
After the grep command is executed, the "-- color = auto" parameter can be added to the output color of the terminal.
The other two methods are as follows:
1. Set environment variables:
Export GREP_OPTIONS = "-- color = auto"
2. Modify. bashrc
Alias grep and set it with alias. My system has been written but commented out,
Now open him and see 84 rows:
84 alias grep = 'grep -- color = auto'
85 # alias fgrep = 'fgrep -- color = auto'
86 # alias egrep = 'egrep -- color = auto'
In this way, the standard output after grep execution marks the matching file as a color.
[Root @ mode etc] # grep allowed_host/usr/local/nagios/etc/nrpe. cfg
Allowed_hosts = 172.30.71.20
If the configuration is ineffective, modify the secureCRT settings:
Location:
Options-> Global options-> General-> Default session-> Edit Default Settings-> Terminal->
Appearance-> Font
Option-Global Options-General-default session-edit default settings-simulation (terminal set to Linux and use color schemes)-appearance (font Lucida Console 10pt, character encoding UTF-8)
Close the current session after setting. Open it again.
----------------
Set colors
Option-session-terminal-simulation-ANSI color (tick)
Grep uses concise and Regular Expressions
Shell programming in Linux -- basic use of the grep command
Grep command details and related examples
Linux basic commands-grep
Set grep to highlight matching items
Linux grep command learning and summary
This article permanently updates the link address: