In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the use of the Findstr command, the article is very detailed, has a certain reference value, interested friends must read it!
Findstr can find the exact text you are looking for in any ASCII file or file. However, sometimes there is only part of the information to match or to find a broader range of information. In this case, findstr has the powerful ability to search for a variety of text using regular expressions.
A regular expression is a symbol used to specify a text type, as opposed to an exact string. Tags use text characters and metacharacters. Every character that has no special meaning in regular expression syntax is a literal character that matches the character that appears. For example, letters and numbers are literal symbols. Metacharacters are symbols that have a special meaning (operator or delimiter) in regular expression syntax.
Exampl
Separate multiple search strings with spaces, unless the parameter is prefixed with / c.
Findstr "hello there" x.y
To search for "hello" or "there" in the file x.y, type:
Findstr / c: "hello there" x.y
To find all the words "Windows" (with the first letter W capitalized) that appear in the file Proposal.txt, type:
Findstr Windows proposal.txt
If you want to search for several different items in the same group of files, create a text file on the new line that contains each search criteria. You can also list the exact files to search for in text files. To use the search criteria in the file Finddata.txt to search for the files listed in Filelist.txt, and then save the results to the file Results.out, type:
Findstr / g:finddata.txt / f:filelist.txt > results.out
Suppose you want to find every file that contains the word "computer" in the current directory and all subdirectories, regardless of the case of letters. To list all files that contain the word "computer"
Please type:
Findstr / s / I / m "\" *. *
Now suppose you need to look not only for the word "computer", but also for all other words that start with the letter "comp", such as "compliment" and "compete". Please type:
Findstr / s / I / m "\
To find all lines that contain the word "FOR" (preceded by any space, such as a loop in a computer program), and include the line number that appears each time, type:
Findstr / b / n / c: "* FOR" * .bas
To search for each file in the current directory and all subdirectories that contain the word Windows, regardless of letter case, type:
Findstr / s / I Windows *. *
Note: the path to use this command
C:\ WINDOWS\ system32\ drivers > findstr / m / l thre * .sys
Look for the sys driver file in the system file labeled "Thre" to see if the poolmon non-page buffer pool will grow. Is it necessary to turn on the 3gb switch?
Annex 1: findstr's own help message:
C:\ WINDOWS\ system32\ drivers > findstr /?
Look for a string in the file.
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 begins the pairing mode on a line.
/ E pairing mode at the end of a line.
/ L uses the search string by word.
/ R uses the search string as a general expression.
/ S search in the current directory and all subdirectories
Match the file.
/ I specifies that searches are case-insensitive.
/ X prints lines that match exactly.
/ V prints only lines that do not contain matches.
/ N prints the number of lines before each line that matches.
/ M if the file contains a match, only its file name is printed.
/ O prints the character offset before each matching line.
/ P A file with slightly unprintable characters.
/ OFF [LINE] does not skip files with offline property sets.
/ A:attr specifies the color attribute with hexadecimal digits. Please see "color /?"
/ F:file reads the list of files from the specified file (/ on behalf of the console).
/ C:string uses the specified string as the text search string.
/ G:file gets the search string from the specified file. (/ represents the console).
/ D:dir finds a list of directories delimited by semicolons
The text that strings is looking for.
[drive:] [path] filename
Specify the file to find.
Unless the parameter has a / C prefix, use a space to separate the search string.
For example: 'FINDSTR "hello there" x.y' look for "hello" or "x.y" in the file x.y
"there". 'FINDSTR / C: "hello there" x.y' file x.y look for
"hello there".
Quick reference to general expressions:
. Wildcards: any character
* repetition: zero or more times in previous characters or categories
^ line position: the beginning of the line
Line position: the end of the line
[class] character category: any character in the character set
[^ class] complement category: any character that is not in the character set
[xmury] range: any character within a specified range
\ x Escape: text usage of metacharacter x
\ word position: the end of the word
The above is all the contents of the article "what is the use of Findstr commands?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.