PowerTip: Use PowerShell to Parse Text Files

Doctor Scripto

Summary: Quickly search files for text with Windows PowerShell.

Hey, Scripting Guy! Question How can I use Windows PowerShell to quickly search text files for a string?

Hey, Scripting Guy! Answer Use the Select-String cmdlet and supply a path and a pattern.
          In the following example, I search the current folder for the computer name dc13:

Select-String -Path *.txt -Pattern ‘dc13’


Discussion is closed.

Feedback usabilla icon