Átomo
14Ss
Busca e objetos · Windows

Select-String

Abrir na tabela

Definição

Procura texto em arquivos com padrões, o grep do PowerShell. Devolve linha, número e arquivo.

Exemplos

1. Em um arquivo
Select-String -Path app.log -Pattern "ERROR"
Select-String app.log "timeout" -CaseSensitive:$false
2. Em uma pasta
Get-ChildItem -Recurse -Filter *.py | Select-String "customer_id"
3. Contexto e só os arquivos
Select-String app.log "Traceback" -Context 2,3
Get-ChildItem -Recurse *.sql | Select-String "TODO" -List | Select-Object Path

No mesmo grupo