grep and Egrep

Source: Internet
Author: User
Tags egrep

When there is only one match condition: The egrep pattern file is equivalent to the GREP-E pattern file

For example:


When multiple match conditions are available, you can only use egrep-e pattern1-e pattern2-e pattern3 ... filename,
You can't use grep-e pattern1-e pattern2 filename, because grep-e pattern1-e pattern2 filename is bound to have no results. (This shows that the usage on page 125th of the Linux Shell Script Introduction Second edition is wrong):

Oddly, when using egrep, multiple match conditions are used, and the number of results matched is not equal to the sum of the number of results using a single match condition, respectively:

In the above example, the sum of the result numbers using two conditions is 9415528+787768=10203296, but the result number with two matching conditions is 10201972, compared with 1324 results:

grep and Egrep

Related Article

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.