Last active
December 18, 2015 15:28
-
-
Save bijanebrahimi/5804254 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 | |
for i in `seq 1 42`; do | |
echo "retreiving page $i" | |
page_content=$(wget -q -O - "$@" http://iconmonstr.com/page/$i/) | |
echo ${page_content/$'\n'/} | grep -o "<svg [^>]*> <path [^>]*>" | while read svg; do | |
file_name=$(echo $svg | grep -o "id=\"[^\"]*\"" | sed 's/id="//' | sed 's/"//') | |
echo -en " ${file_name}.svg\t" | |
cat > ${file_name}.svg << EOF | |
<?xml version="1.0" encoding="utf-8"?> | |
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> | |
$svg | |
</svg> | |
EOF | |
echo " OK" | |
done | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment