Select-String
Search text like grep
Select-String -Path .\docs\*.md -Pattern 'TODO'
- Works on
- WindowsLinuxmacOS
- PowerShell
- 5.1 and later
- Reference
- Microsoft Learn: Select-String
This is grep. -Pattern can be a regex. -SimpleMatch treats it as literal text. -Path accepts wildcards. Pipeline input works too.
Try this
Select-String -Path .\docs\*.md -Pattern 'TODO' -SimpleMatch
Coming from another shell
| Shell | What you might type |
|---|---|
| bash / zsh | grep -rn 'TODO' docs/ |
| cmd.exe | findstr /s /n TODO docs\*.md |
More in From bash and From cmd.