Skip to content

Instantly share code, notes, and snippets.

@bijanebrahimi
Last active December 18, 2015 15:28
Show Gist options
  • Save bijanebrahimi/5804254 to your computer and use it in GitHub Desktop.
Save bijanebrahimi/5804254 to your computer and use it in GitHub Desktop.
#!/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