Search filter grep (win under FINDSTR)

Source: Internet
Author: User

Search filter grep (Win under Findstr)

1. Main parameters

    [Options] Main parameters:
-C: Outputs only the count of matching rows.
-i: Case insensitive
-H: The file name is not displayed when querying multiple files.
-L: Only file names with matching characters are output when querying multiple files.
-N: Displays matching lines and line numbers.
-S: does not display error messages that do not exist or have no matching text.
-V: Displays all lines that do not contain matching text.

    Pattern Regular Expression main parameters:
    \: Ignores the original meaning of special characters in regular expressions.
    ^: matches the start line of the regular expression.
    $: Matches the end line of the regular expression.
    \<: Starts from the line that matches the regular expression.
    \>: End of line to match regular expression.
    []: A single character, such as [a], a meets the requirements.
    [-]: range, such as [A-z], i.e. A, B, C to Z all meet the requirements.
    .: all the individual characters.
    *: There are characters, the length can be 0.

2. example  

(1) grep ' test ' d* #显示所有以d开头的文件中包含 Test line
(2) grep ' Test ' AA bb cc #显示在aa, bb,cc file contains test line
(3) grep ' [a-z]\{5\} ' AA #显示所有包含每行字符串至少有5个连续小写字符的字符串的行
(4) grep magic/usr/src #显 The file ( ) contains magic lines
(5) grep-r magic/usr/src #显示/usr/src directory file ( contains subdirectories ) contains Line of Magic

  (6) Grep-w pattern files: matches only the entire word , not a part of the string (such as matching ' magic ', not ' magical '),

Search filter grep (win under FINDSTR)

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.