find -name foo.* | xargs grep “find_me”

[Update from Brad Wilson and Scott Dukes]

I’ve been wanting a powershell script to replace my favorite unix command for ages, and I took a stab at it today. This got me very close to what I wanted yesterday, which was just the names of files where the matches occurred.

get-childitem -include foo.* -recurse | where-object { get-content $_ | select-string find_me }

Scott Dukes pointed out that select-string would take the FileInfo object that was passed to it and search through the contents for the string file_me, and this would give me the exact same kind of output my unix command used to. Thanks, Scott! This command was exactly what I needed.

Brad went way past this and showed some very interesting other changes to the script to do some cool things.

Thanks again to both of them for correcting this PowerShell newbie. I’ve been a long-time Unix scripting weenie, with bash code flowing out my fingertips at will (in XEmacs of course :)), but I think PowerShell just blows that away.

— bab

11 thoughts to “find -name foo.* | xargs grep “find_me””

  1. Overall Petit Roid 3 is a hilarious hentai manga that has so many merits, which separate it from the average hentai manga; such as its length and the fact that it follows one story throughout. It manages to contain plenty of fetishes (loli, bukkake, S&M, etc.) to satisfy any guy who reads this and what’s more amazing

    http://triometr.info/index.php?sm=6

    http://forter.info/index.php?sm=8

    http://forter.info/index.php?sm=9

    http://kriomotors.info/index.php?sm=4

    is how it can give you boner and make you laugh at the same time. But nonetheless it still is a hentai manga and there’s only so much that it can accomplish, still it is definitely one any perv should check out.

  2. Unix find equivalent in Powershell Find-ChildItem

    "Find is one of the most often used commands in day to day work life. Unix find command provides lot of features and options that enable users to find files/directories more effectively

    In Powershell, we can use Get-ChildItem cmdlet to search for files. But it doesn’t give you all the fun. So I have developed Find-ChildItem Powershell cmdlet which is equivalent to Unix find command"

    Check out this link to download Find-ChildItem Cmdlet: http://windows-powershell-scripts.blogspot.com/2009/08/unix-linux-find-equivalent-in.html

    Hope this helps you

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.