A Small but Useful PowerShell Script
Contents
I always keep this little PowerShell script handy for when I need to search my source code for instances of a particular word or phrase. Most modern IDEs have this kind of functionality built in, but you never know when you’ll have to work with a language or tool that isn’t quite as robust.
$search_path = "c:\Your\Search\Path\"
$search_pattern = "YourSearchTerm"
clear
Get-ChildItem -recurse -include *.txt, *.cs $search_path | `
Select-String -pattern $search_pattern | `
Format-List -GroupBy Filename -Property LineNumber, Line
Tags:
automation