Findstr, do you know?

Source: Internet
Author: User
Tags printable characters
In view of the concept of appearance, I only know that find is used to find:

All searches on the Internet are for find usage.

Find in Linux is powerful, and files, directories, and strings are omnipotent.

However, in windows, find only searches for files and directories. If you do not know findstr, you certainly think that find can find and search for specific strings in the file, then you can only hit the south wall with a head.

Help is listed below:

Search for strings in files

Findstr [/B] [/E] [/L] [/R] [/S] [/I] [/X] [/V] [/n] [/m] [/o] [/F: file]
[/C: String] [/G: file] [/D: Dir list] [/A: color attributes] [/off [Line]
Strings [[drive:] [path] filename [...]

/B starts the pairing mode on a row.
/E matches the end of a row.
/L use search strings by words.
/R uses the search string as a general expression.
/S search for the current directory and all subdirectories
Match files.
/I indicates that the search is case-insensitive.
/X print the exact matched rows.
/V only prints the rows that do not contain the matching data.
/N prints the number of rows before each row.
/M if the file contains a match, only the file name is printed.
/O prints the character offset before each matching row.
/P ignores files with printable characters.
/Off [Line] does not skip files with offline attribute sets.
/A: ATTR specifies the color attribute of a hexadecimal number. See "color /? "
/F: the list of files read from a specified file (/indicates the console ).
/C: String uses the specified string as the text search string.
/G: file obtains the search string from the specified file. (/Stands for the console ).
/D: Dir: Find the list of directories separated by semicolons
Strings text to be searched.
[Drive:] [path] filename
Specifies the file to be searched.

Unless the parameter has a/c prefix, use spaces to separate the search string.
For example, 'findstr "Hello there" x. Y' searches for "hello" or
"There ". 'Findstr/C: "Hello there" x. Y' file x. y
"Hello there ".

Quick Reference for general expressions:
. Wildcard: any character
* Repetition: Previous characters or categories that appear zero or more times
^ Row position: Start of a row
$ Row position: end of the row
[Class] character category: any character in the character set
[^ Class] character population category: any character that is not in the character set
[X-y] range: any character in the specified range
\ X escape: Text usage of metacharacters x
\ <XYZ position: Start of a word
XYZ \> word position: End of a word

For more information about the common expressions of findstr, see online command reference.

Application:

Just look at the syntax and examples. Next, try again!

Conclusion:

Not only do I like the doscommand, but I also need to go deep into the ocean.

Like Linux, like command line and parameterization, It is very convenient for background deployment.

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.