-
-
Save maximkott/7fd6908aeaa982864b93 to your computer and use it in GitHub Desktop.
Recursively replace a pattern in files
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
#!/bin/bash | |
if [ -z "$1" ]; then | |
echo "mising argument: query" | |
exit 0 | |
fi | |
if [ -z "$2" ]; then | |
echo "mising argument: replace" | |
exit 0 | |
fi | |
find . -depth -name "*${1}*" -execdir rename "s/${1}/${2}/g" "{}" \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment