Created
February 1, 2019 10:26
-
-
Save tomoyanonymous/63af94185ed5ca31523557e4fd8772fe to your computer and use it in GitHub Desktop.
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 | |
cd `dirname $0` | |
IFS=' | |
' | |
for file in $(find content -type f -name index.*md ); do | |
echo $file | |
cppath=`echo $file|sed -E 's!(.*)/(.*\..*)!\1!g' ` | |
for grep in $(cat $file | grep -e "JPG" -e "jpg" -e "png" -e "svg" -e "" ); do | |
echo "grepped $grep" | |
img=`echo $grep| sed -E 's!(.*)(\(| |"|/)(.*)(\.)([a-zA-Z]{3,4})(.*$)!\3\4\5!g' ` | |
echo "img: $img" | |
imgpath=`find static -type f -name $img` | |
echo "copy $imgpath to $cppath" | |
cp -a $imgpath $cppath | |
done | |
# cat $file | sed -E 's$(/?assets/img)(.*)/(.*)(\.)([a-z]{3,4})$\3\4\5$' > tmpfile | |
# mv tmpfile $file | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment