Created
April 27, 2016 18:53
-
-
Save lub/47a9136bda6f673fad6885cea6092c3c to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
file='ips.txt' | |
max=`curl -s 'https://en.greatfire.org/search/ip-addresses' | grep 'page=' | grep 'last' | sed 's/.*\([0-9]\{3,4\}\).*/\1/'` | |
for i in $(seq 0 $max); do | |
echo 'Starting Download '$i | |
curl -s 'https://en.greatfire.org/search/ip-addresses?page='$i | grep 'td class="first"' | sed 's/.*\([0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\).*/\1/' >> $file & | |
done | |
while killall -0 curl; do | |
current=`echo $(ps -x | grep curl | wc -l)-1 | bc` | |
echo 'Downloads still running. '$current' remaining' | |
sleep 5 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment