Skip to content

Instantly share code, notes, and snippets.

@LiamHz
Last active October 13, 2018 01:07
Show Gist options
  • Save LiamHz/edabcb06bb91a338317b66288ff58208 to your computer and use it in GitHub Desktop.
Save LiamHz/edabcb06bb91a338317b66288ff58208 to your computer and use it in GitHub Desktop.
Search through current directory for any matches of specified text
# Search through current directory and all sub directories for text
dir -Recurse | Select-String -pattern "STRING"
# Recursive search and table formatting
dir -Recurse | Select-String -pattern "latest_net_G" | Select Path, LineNumber, Line | Format-Table
# Search through all files with the .EXT extension in the current directory
# and find any lines that match with STRING
Select-String -Path *.EXT -Pattern "STRING"
# Table formatting
Select-String -Path *.py -Pattern "fc3" | Select Filename, LineNumber, Line, Path | Format-Table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment