Shell review notes ---- search and replace, shell review notes ----

Source: Internet
Author: User

Shell review notes ---- search and replace, shell review notes ----

Search for documents

It is quite convenient to search for text (match text matching text) using the grep program. Traditionally, there are three programs that can be used to search for the entire text file.

  • Grep's earliest text match program. The simplest method is to use a fixed string.
    $ Who | grep-F austen // use the-F option in the example to find the fixed string austen.

    In fact, as long as the matching mode does not contain the meta character of the regular expression (metacharacter), grep's default behavior mode is equivalent to using-F.

    $ Who | grep austen

     

  • Egrep extended type grep. This program uses extended regular expressions-this is a set of more powerful regular expressions, the cost of using it is better than more computing resources.
  • Fgrep Fast grep (Fast grep). This version matches fixed strings rather than regular expressions. It uses an optimized algorithm to effectively match fixed strings.

Regular Expression

A regular expression is a representation that allows you to search for texts that match a specific criterion. This Representation allows you to write an expression that selects or matches multiple data strings.

In addition to the traditional UNIX regular expressions, POSIX regular expressions can also be:

  • Write a regular expression that indicates the sequence of characters and equivalent characters specific to locale.
  • Write Regular Expressions without having to worry about the underlying character set of the system.

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.