Marshall's Weblog

Embiggen Your Mind

Marshall's Weblog header image 2

Emulating Grep in Powershell

December 6th, 2007 · 1 Comment

Grep is one of my favorite tools to help me find something in a set of files. Since I cannot download Cygwin at work, I have to make due with what I have.

The following is a translation of grep -R "mypattern" *.cpp for Powershell.

gci C:\path\to\files\* --include *.cpp -recurse | select-string -pattern "mypattern" -caseSensitive

<sarcasm>
So much easier to remember…
</sarcasm>

Tags: General

1 response so far ↓

  • 1 FkYko // Mar 25, 2010 at 1:00 am

    Or you could have written

    ls * *.cpp -r | ss mypattern -ca

    for the same thing

Leave a Comment