One linux Command per day grep

Source: Internet
Author: User
Tags perl regular expression

The grep function of a linux Command per day is to find the content specified by PATTERN in a file or standard input. And display the row. Grep -- help can be used to view command parameters. The basic format is grep [OPTION]... PATTERN [FILE]... grep test file1. Search for test in file1. If file1 is replaced with-(minus sign) or is not written, it is the standard input. -E pattern is an extended regular expression. -F pattern is a fixed string and is not considered as a regular expression. -G pattern is a basic regular expression. -P pattern is a Perl regular expression. -E uses PATTERN as a regular expression. -F file1: Obtain the PATTERN from the file. -I ignore case sensitivity. Www.2cto.com-w. -X matches the entire row. -Z: a data row ends with 0 bytes instead of line breaks. -S does not display the error message. -V invert selection (list non-conforming rows ). -M n: a maximum of n matching results can be displayed. -B prints the byte offset in the result. -N: print the row number in the result. -H: print the file name in the result. (Mainly used to search for multiple files)-h does not display the file name. -O only displays the content that meets the conditions, rather than the whole line. -Q does not display any information. (Do not understand what this is for)-a does not ignore binary data. -I: Ignore binary. -D: used when the directory is to be searched. Parameters include 'read', 'recurse', or 'skip'-D. The parameters include 'read' or 'skip'-r-R recursive directory. -L list file names that do not match the specified template style. Www.2cto.com-l lists the file names that match the specified template style. -C: displays the number of qualified rows. -Z displays 0 bytes after the file. (Do not understand what it means)-B n displays the qualified rows and the first n rows. -A n: the rows that meet the conditions and the last n rows are displayed. -C n: displays the qualified rows and the n rows before and after the condition. -NUM is the same as-c num. Author: CrazyNemo

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.