Skip to content

Instantly share code, notes, and snippets.

@andres-alvarado

andres-alvarado/script.sh

Last active Nov 8, 2020
Embed
What would you like to do?
#! /bin/bash
# Temporadas
from_season=${1}
to_season=${2}
# Constantes para descargar y procesar archivos de Rtrosheet
retrosheet_url="https://www.retrosheet.org/events/"
season_type_files="eve post"
# Para cada season
for s in $(seq ${from_season} ${to_season})
do
echo "Procesando temporada ${s}"
# Para cada season type
for t in ${season_type_files}
do
echo -e "\tProcesando ${t}"
echo -e "\t\tDescargando archivos"
wget ${retrosheet_url}${s}${t}.zip &> /dev/null
echo -e "\t\tDescomprimiendo archivos"
unzip ${s}${t}.zip &> /dev/null
echo -e "\t\tEjecutando Chadwick para Eventos"
cwevent -q -n -f 0-96 -x 0-60 -y ${s} ${s}*EV* > ${s}_${t}_events.csv 2> /dev/null
echo -e "\t\tEjecutando Chadwick para Partidos"
cwgame -q -n -f 0-83 -x 0-94 -y ${s} ${s}*EV* > ${s}_${t}_games.csv 2> /dev/null
echo -e "\t\tEjecutando Chadwick para Sustituciones"
cwsub -q -n -f 0-9 -y ${s} ${s}*EV* > ${s}_${t}_subs.csv 2> /dev/null
echo -e "\t\tLimpiando Archivos"
rm *EV*
rm *ROS*
rm *TEAM*
rm *.zip
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.