Created
August 12, 2016 13:44
-
-
Save yunghoy/e552495e55bd69024c3a3d961334811d to your computer and use it in GitHub Desktop.
I hate a simplest job such as substituting a word for another in various files
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
SOURCEDIR=utils | |
TARGETDIR=util | |
pushd be > /dev/null | |
SERVICES="$(ls -d *-island)" | |
popd > /dev/null | |
for SERVICE in ${SERVICES}; do | |
pushd be/${SERVICE}/src > /dev/null | |
if [ -d SOURCEDIR ]; then | |
echo "--------------------------------------------------" | |
echo "Modifying the island: ${SERVICE}" | |
# type your command | |
mkdir ${TARGETDIR} | |
cp ${SOURCEDIR}/*.ts ${TARGETDIR} | |
rm -rf ${SOURCEDIR} | |
grep -rl "\/utils\/" | xargs sed -i 's/\/utils\//\/util\//g' | |
grep -rl "\/utils" | xargs sed -i 's/\/utils/\/util\//g' | |
grep -rl "utils\/" | xargs sed -i 's/utils\//\/util\//g' | |
# end of your command | |
fi | |
popd > /dev/null | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment