Skip to main content

Grep equivalent in powershell

This one uses a file as the regex

Get-Content .\doc.txt | Select-String -Pattern (Get-Content .\regex.txt)
 
 
This one prints the line before as well  
 
Get-Content .\doc.txt | Select-String -Pattern 'test' -context 1
 

Comments

Popular posts from this blog