Last active
February 27, 2025 05:18
-
-
Save markbosky/e1046f61d6db49928ff202f5a6a3a82d to your computer and use it in GitHub Desktop.
Quick Commands For Searching Strings Across Text Files (Powershell)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Powershell | |
Get-ChildItem -Path . -Recurse -Filter *.txt | Select-String -Pattern "whatever/.com" | ForEach-Object { "$($_.Path): Line $($_.LineNumber): $($_.Line)`n" } | | |
Out-File -FilePath results.txt | |
Get-ChildItem -Path . -Recurse -Filter *.txt | Select-String -Pattern "\@whatever\.com" | ForEach-Object { "$($_.Path): Line $($_.LineNumber): $($_.Line)`n" } | Out-File -FilePath "results_$(Get-Date -Format 'yyyy-MM-dd_HH-mm-ss').txt" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment