Select-String: The grep Of Powershell
When writing PowerShell code and you need to search for text inside of a single string or an entire text file, where do you turn? If you’ve used Linux very much, you’re probably familiar with the popular grep utility. The grep utility allows a user to search text using some different options, but this utility doesn’t exist in Windows. Are we out of luck? No. We’ve got the Select-String cmdlet.
Let’s say you’ve got a big string of containing various employee names and addresses. Unfortunately, this string isn’t in any well-known structure, so you’re forced to pull out all of the employee names via text parsing. How would you make that happen? First, let’s start with the example string we’ll be using.
Read the full article at Ipswitch.