Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

findstr

From Wikipedia, the free encyclopedia
Shell command for searching text files
findstr
Other namesqgrep
DevelopersMicrosoft, ReactOS Contributors
Operating systemWindows,ReactOS
PlatformCross-platform
TypeCommand
LicenseWindows:Proprietarycommercial software
ReactOS:GNU General Public License
Websitedocs.microsoft.com/en-us/windows-server/administration/windows-commands/findstr

findstr is ashellcommand that searches for text infiles[1] and prints matching lines tostandard output.[2]The command provides similar functionality asfind, butfindstr supportsregular expressions. However,findstr does not supportUTF-16 whereasfind does.findstr cannot search fornull bytes commonly found inUnicode computer files.[3]

findstr was first released as part of theWindows 2000Resource Kit under the nameqgrep.[4]The command is available inWindows[5][6] andReactOS.[7]

Use

[edit]

The command syntax can be described as:

findstr FLAGS TEXT PATH...
TEXT
Text to search for.
PATH
Path to a file.

FLAGS:

/B
Match pattern if at the beginning of a line.
/E
Match pattern if at the end of a line.
/L
Use search strings literally.
/R
Use search strings as regular expressions.
/S
Search for matching files in the current directory and all subdirectories.
/I
Ignore case for matching.
/X
Print lines that match exactly.
/V
Print lines that donot match.
/N
Print the line number before each line that matches.
/M
Print only thefile name if a file contains a match.
/O
Print character offset before each matching line.
/P
Skip files withnon-printable characters.
/OFF[LINE]
Do not skip files with offline attribute set.
/A:attr
Specifies color attribute with two hex digits. See "color /?"
/F:file
Reads file list from the specified file (/ for console).
/C:string
Use specified string as a literal search string.
/G:file
Get search strings from the specified file (/ for console).
/D:dir
Search a semicolon delimited list of directories
/?
Print help information about the command.

Example

[edit]

The following command searches the file named "services.txt" for lines containing "network" ignoring case.

findstr /i"network" services.txt

See also

[edit]
Wikibooks has a book on the topic of:Guide to Windows Commands

References

[edit]
  1. ^MS-DOS and Windows command line findstr command
  2. ^Excellent documentation on usage of findstr
  3. ^Findstr - Search for strings - Windows CMD - SS64.com
  4. ^History of Findstr from Raymond Chen
  5. ^Microsoft WinXP documentation for findstr
  6. ^Microsoft Server 2012/2016 documentation for findstr
  7. ^"Reactos/Reactos".GitHub. 16 October 2021.

Further reading

[edit]

External links

[edit]
Ecosystem
Interpreters
Terminals
File system navigation
File management
Archiving
Disk management
Processes
Registry
User environment
File contents
Scripting
Networking
Maintenance and care
Boot management
Software development
Miscellaneous
Retrieved from "https://en.wikipedia.org/w/index.php?title=Findstr&oldid=1315749595"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp