Skip to content

Instantly share code, notes, and snippets.

@mattjj
Last active December 10, 2015 10:38
Show Gist options
  • Save mattjj/4421916 to your computer and use it in GitHub Desktop.
Save mattjj/4421916 to your computer and use it in GitHub Desktop.
get TIPS prices
#!/bin/bash
curl -s "http://online.wsj.com/mdc/public/page/2_3020-tips-${1}.html?mod=mdc_pastcalendar" \
| tr '^M' '\n' \
| grep -E '<td class="(([pn]?num)|(text))">' \
| sed -E 's/<[^>]*>([^<]*)<.*/\1/' \
| awk '(NR%6==0){print p; p=""; next}{p=p "\t" $0;}' \
| sed "s/^/${1}/"
@mattjj
Copy link
Author

mattjj commented Dec 31, 2012

(for start in {11,18,25}; do for offset in {0..4}; do get_TIPS_prices.sh "201107$(printf %02d $((start+offset)))"; done; done;) \
| tee cachefile \
| grep -E '^[0-9]+\s+2041 Feb 15' \
| awk '{print $1 "\t" $6}' \
| sed -E 's/^([0-9]{4})([0-9]{2})([0-9]{2})/\1 \2 \3/' \
| dateplotter.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment