Created
May 16, 2023 14:54
-
-
Save gautam-nutalapati/d5c6c0acae841f38372965e8fa6b3818 to your computer and use it in GitHub Desktop.
Bash Useful Search Commands (to manage bulk git repositories)
This file contains 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
# Find multiple texts in all files under current directory | |
grep -rns '.' -e 'text-1' -e 'text-2' | |
# Find text 'text-1' in files of name 'ci.yaml' under current directory | |
grep -rns '.' -e 'text-1' --include=ci.yaml | |
# Find text 'text-1' in files of name 'ci.yaml' under current directory and pring 2 lines after the text found | |
# (-B for lines before and -C for both above and below) | |
grep -rns '.' -e 'text-1' --include=ci.yaml -A 2 | |
# Go to all subdirectories in current directory and execute comamnds 'pwd' AND 'git status' | |
find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && pwd && git status" \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment