Skip to content

Instantly share code, notes, and snippets.

@guriandoro
Created May 22, 2019 06:05
Show Gist options
  • Save guriandoro/d6dff78f3bd2b5f626420bb452830e39 to your computer and use it in GitHub Desktop.
Save guriandoro/d6dff78f3bd2b5f626420bb452830e39 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Example link:
# http://www.precios.uy/images/sipc/analisisdeprecios/reportes/mensual/2017/Setiembre/cadenas.pdf
for year in `seq 2016 2018`; do
month_numeric=1;
echo $year;
mkdir $year && cd $year;
for month in Enero Febrero Marzo Abril Mayo Junio Julio Agosto Setiembre Octubre Noviembre Diciembre; do
echo $month;
wget "http://www.precios.uy/images/sipc/analisisdeprecios/reportes/mensual/$year/$month/cadenas.pdf" \
-O precios_cadenas_${year}_${month_numeric}_${month}.pdf
month_numeric=$((${month_numeric}+1));
done;
cd ../;
done;
# For partial year
echo 2019;
year=2019;
month_numeric=1;
mkdir $year && cd $year;
for month in Enero Febrero; do
echo $month;
wget "http://www.precios.uy/images/sipc/analisisdeprecios/reportes/mensual/$year/$month/cadenas.pdf" \
-O precios_cadenas_${year}_${month_numeric}_${month}.pdf
month_numeric=$((${month_numeric}+1));
done;
cd ../;
# Hack for changed name in file:
wget http://www.precios.uy/images/sipc/analisisdeprecios/reportes/mensual/2018/Octubre/cadenas1.pdf -O ./2018/precios_cadenas_2018_10_Octubre.pdf
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment