Grep command output displays highlighted characters

Source: Internet
Author: User

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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.