Skip to content

Instantly share code, notes, and snippets.

@cwpearson
Created November 1, 2018 11:29
Show Gist options
  • Save cwpearson/491d6325ace5fcab1d6f02b540157d1f to your computer and use it in GitHub Desktop.
Save cwpearson/491d6325ace5fcab1d6f02b540157d1f to your computer and use it in GitHub Desktop.
Download gaia data release 2
#! /bin/bash
index_url="http://cdn.gea.esac.esa.int/Gaia/gdr2/gaia_source/csv/"
index_html=`curl $index_url`
while read -r line; do
# echo $line;
match=`echo $line | grep -oE 'href\="(.*.csv.gz)'`;
# echo $match;
match=${match#href=\"} ;# remove prefix starting with 'href="'
# echo $match;
url="$index_url/$match";
echo $url;
ec=18;
while [ $ec -eq 18 ]; do
curl -O -C - "$url";
ec=$?;
done
done <<< "$index_html"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment