Text Processing Three musketeers: grep

Source: Internet
Author: User
Tags expression engine egrep

One, Grep:global searchregular expression and Print out of the line.

Text Filter tool (Pattern: pattern) Tool

(1) function:

1) Text Search Tool

2) match the target text line by row according to user-specified "mode (filter)";

3) print matches to the Whole Line text ;

(2) Pattern: The filter condition written by metacharacters and text characters of regular expressions;

mode through Regular expression engine Match Search

(3) format

grep [OPTIONS] PATTERN [FILE ...]

grep [OPTIONS] [-E PATTERN |-f file] [FILE ...]

OPTIONS:

--color=auto: Color The matching text to highlight;

-i:ignorecase, ignoring the case of characters;

-O: Displays only the string that matches to itself;

-V,--invert-match: Displays rows that cannot be matched by a pattern;

-E: Supports the use of extended regular expression metacharacters;

-Q,--Quiet,--silent: Silent mode, that is, do not output any information;

-a#:after, after # line

-b#:before, Front # line

-c#:context, front and back # lines



Second, Egrep: An extended regular expression implementation similar to the grep text filtering function; Grep-e

Egrep [OPTIONS] PATTERN [FILE ...]

Options:-i,-o,-V,-Q,-A,-B,-C

-G: support for basic regular Expressions



Third, Fgrep: Regular expression meta-characters are not supported;

When there is no need to use meta-characters to write patterns, the use of fgrep will be better;

In the data volume Super large text analysis is the speed manifest obvious


This article is from the "Xu Ding blog" blog, make sure to keep this source http://xuding.blog.51cto.com/4890434/1726587

Text Processing Three musketeers: grep

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.