The Powershell equivalent to grep

I’m posting this mainly for my own use, since I keep forgetting the syntax. To search for a string in a source code tree, the command would look something like this:

Get-ChildItem -filter *.cs -recurse | Select-String -pattern "SearchTerm" -casesensitive

Plus or minus options, of course. You can also specify a base path for Get-ChildItem if required.

Leave a comment