Search code examples
windowslinuxgrepwildcardfindstr

grep like syntax with findstr


ive been using grep a lot on linux lately but now i need to use findstr to carry out the same tasks on a windows machine and cant quite get the syntax just right.

My grep command looks like:

grep "12/12/2011.\*followed by literal string" /myFile.txt

so this searches for the date and the literal string specified but can contain a mix of any other characters in between the two search terms by using .\*

Anyone know how to convert this statement to findstr? thanks


Solution

  • The findstr command supports the /R option to specify the search string as a regular expression. It's the default behavior, however, so you don't actually need to specify it:

    findstr "12/12/2011.*followed by literal string" myFile.txt
    

    The above should give the same results as your grep example.