xxxxxxxxxx
To grep in powershell use Select-String. Select-String uses regex wildcards
so you have to use .* instead of only * (for instance). You can also specify
path.
ls | Select-String -Pattern ".*Anders.*"
ls | Select-String -Path ".*Code.*" -Pattern ".*\.cs"
xxxxxxxxxx
# Search for a pattern in a file
Get-Content -Path "path\to\file.txt" | Select-String -Pattern "pattern"
# Search for a pattern in multiple files
Get-ChildItem -Path "path\to\directory" -Filter "*.txt" | Get-Content | Select-String -Pattern "pattern"
# Search for a pattern in piped input
Get-Process | Select-String -Pattern "pattern"