Skip to content

Instantly share code, notes, and snippets.

@BenRussert
Created April 22, 2017 15:45
Show Gist options
  • Save BenRussert/009fff28f3e99d23c1340a748224805c to your computer and use it in GitHub Desktop.
Save BenRussert/009fff28f3e99d23c1340a748224805c to your computer and use it in GitHub Desktop.
Download an mlb schedule standardized calendar csv file filtered to include only channels you are interested in
#!/usr/bin/env bash
# this will download a csv format calendar file with TV info and
# filter only channels I want. The output can be imported into google calendar etc
# this url is for the cubs, but you could modify url parameters if you want
csvurl="http://mlb.mlb.com/ticketing-client/csv/EventTicketPromotionPrice.tiksrv?team_id=112&display_in=singlegame&ticket_category=Tickets&site_section=Default&sub_category=Default&leave_empty_games=true&event_type=T"
tmpfullfile="tmpfullfile.csv"
outputfile="cubs-onair-schedule.csv"
curl -o $tmpfullfile $csvurl
head -n1 $tmpfullfile > $outputfile
grep -iP 'wgn|fox|abc' $tmpfullfile >> $outputfile
# cleanup
rm $tmpfullfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment