Friday, June 08, 2012

Windows PowerShell script to find all occurrences of a string in files, all subdirectories

(get-childitem -recurse -include *.java | select-string -pattern PrepareStatement | foreach {$_.line}).Count

I developed this fairly quickly to count the occurrences of "PrepareStatement" in *.java in all sub-directories.  Worked like a charm.  Just in case it does you any good :-)

No comments:

DBA Categories from Brent Ozar

Brent Ozar shared a post on the categories for a SQL Server DBA. NOTE that these overlook things like BI or data scientist professionals, w...