fortypoundhead.com

FINDSTR

Primary Category = Windows Commandline

Posted On 2005-11-1 by FortyPoundHead
Keywords:
Tags: Windows Commandline Windows
Views: 2382
Rating: / 5.00

  • 1
  • 2
  • 3
  • 4
  • 5

 

This article has been updated. The new version is at:

http://www.fortypoundhead.com/showcontent.asp?artid=23684

Search for strings in files.

Syntax

FINDSTR [options] [/F:file] [/C:string] [/G:file] [string(s)] [pathname(s)]

string Text to search for.
pathname(s) The file(s) to search.
/C:string Use string as a literal search string.
/G:file Get search string from a file (/ stands for console).
/F:file Get a list of pathname(s) from a file (/ stands for console).
/d dirlist Search a comma-delimited list of directories.

[options] may be any combination of the following switches:

/I Case-insensitive search.
/S Search subfolders.
/P Skip any file that contains non-printable characters
/L Use search string(s) literally.
/R Use search string(s) as regular expressions.(default)
/B Match pattern if at the Beginning of a line.
/E Match pattern if at the END of a line.
/X Print lines that match exactly.
/V Print only lines that do NOT contain a match.
/N Print the line number before each line that matches.
/M Print only the filename if a file contains a match.
/O Print character offset before each matching line.
/a color_attribute Display filenames in colour (2 hex digits)

When the search string contains multiple words (separated with spaces) then FINDSTR will show show lines that contains any one word - (an OR of each word) - this behaviour is reversed if the string argument is prefixed with /C.

About the Author

FortyPoundHead has posted a total of 1975 articles.

You can find more information from FortyPoundHead by visiting .

Comments On This Post

No comments on this post yet!

 

Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.


Your IP address is:54.163.159.27

Before you can post, you need to prove you are human. If you log in, this test goes away.