Use of the Linux egrep grep command

Source: Internet
Author: User
Tags egrep

Friendly tip: Linux command operations are case-sensitive!

Grep's Full English name: Global search REgular expression and Print out of the line.

The text content search tool searches the target file on a row-by-line basis based on user-specified text patterns (regular expression metacharacters and normal characters) to display rows that can be matched.

Introduction to How to use:

grep [OPTIONS] PATTERN [FILE ...]

Example: Grep-i ' abc '/home/love.txt

The [options] option describes:

-I search is not case-sensitive

-O shows only what is matched to the pattern

-V shows rows that cannot be matched to a pattern

-e using extended regular expressions

--color match to the inside to set the color

--color=[auto|always|never ...]

Color Example: grep--color=auto "Root"/etc/passwd

Pattern Matching mode Description:

' Name ' character form, match as-is

' [0-9][a-z] ' regular match. Do not understand the degree of the mother is the article.

Regular: Basic regular, extended regular.

grep ' \ (abc\) \+ '/home/love.txt basic regular usage mode.

Grep-e ' (ABC) + '/home/love.txt is required with the "-e" option to use the extension.


[FILE ...] Text content Description:

/home/love.txt How to find the path to text

echo ' abc ' | grep--color=auto ' ABC ' transmits text content in a "pipe" way. Pipeline do not understand please niang pipe article.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Egrep with grep, you do not need to add the "-e" option when using the extended regular.

Big rookie wish: a higher level. Welcome to the Big Rookie 3 group: 264723618

This article is from the "Big rookie Linux" blog, make sure to keep this source http://58dream.blog.51cto.com/10078511/1628965

Use of the Linux egrep grep command

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.