Findstr
| findstr | |
|---|---|
| Other names | qgrep |
| Developers | Microsoft, ReactOS Contributors |
| Operating system | Windows, ReactOS |
| Platform | Cross-platform |
| Type | Command |
| License | Windows: Proprietary commercial software ReactOS: GNU General Public License |
| Website | docs |
findstr is a shell command that searches for text in files[1] and prints matching lines to standard output.[2]
The command provides similar functionality as find, but findstr supports some regular expression operators. However, findstr does not support UTF-16 whereas find does. findstr cannot search for null bytes commonly found in Unicode computer files.[3]
findstr was first released as part of the Windows 2000 Resource Kit under the name qgrep.[4]
The command is available in Windows[5][6] and ReactOS.[7]
Use
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 do not match.
/N- Print the line number before each line that matches.
/M- Print only the file name if a file contains a match.
/O- Print character offset before each matching line.
/P- Skip files with non-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
The following command searches the file named "services.txt" for lines containing "network" ignoring case.
findstr /i "network" services.txt
See also
- List of DOS commands
- Find (Unix) – Shell command for finding files
- grep – Command-line utility for text search
References
- ^ MS-DOS and Windows command line findstr command
- ^ Excellent documentation on usage of findstr
- ^ Findstr - Search for strings - Windows CMD - SS64.com
- ^ History of Findstr from Raymond Chen
- ^ Microsoft WinXP documentation for findstr
- ^ Microsoft Server 2012/2016 documentation for findstr
- ^ "Reactos/Reactos". GitHub. 16 October 2021.
Further reading
- Stanek, William R. (2008). Windows Command-Line Administrator's Pocket Consultant, 2nd Edition. Microsoft Press. ISBN 978-0735622623.
- John Paul Mueller (2007). Windows Administration at the Command Line for Windows Vista, Windows 2003, Windows XP, and Windows 2000. John Wiley & Sons. ISBN 978-0470165799.
External links
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.