Last active
May 25, 2016 02:30
-
-
Save secvalve/146344788627bea58d386700685ab525 to your computer and use it in GitHub Desktop.
A bash script that uses CURL to get a file in parts, ala axel. Paralellised version of baxel https://gist.github.com/secvalve/fbe41b7cc45812e386c6c8ea95075d3c. Usage: parabaxel numparts url eg ./parabaxel 3 http://www.google.com/robots.txt robots.txt
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 | |
#$1 numparts, #$2 url, #$3 outfile | |
#Get total length | |
TL=$(curl -sI $2 | grep Content-Length | awk '{printf "%d", $2}') | |
echo "$s is $TL Bytes Long" | |
let CHUNKSIZE=$(( TL / $1 )); | |
parallel -k curl -s -r {} $2 ::: $(for i in `seq -f "%.0f" 0 $CHUNKSIZE $(( $TL - $CHUNKSIZE ))`; do echo "$i-`expr $i + $CHUNKSIZE`"; done) #> $3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment