Skip to content

Instantly share code, notes, and snippets.

@dolpen
Last active February 24, 2017 03:23
Show Gist options
  • Save dolpen/3e95e428a49c2aa20224e61f42bb2e21 to your computer and use it in GitHub Desktop.
Save dolpen/3e95e428a49c2aa20224e61f42bb2e21 to your computer and use it in GitHub Desktop.
using only osx(posix) grep/sed. あとawk縛りルール
$ curl -s http://www8.cao.go.jp/chosei/shukujitsu/syukujitsu.csv | iconv -f Shift_JIS -t UTF-8 | sed -E $'s/\r//g' | grep -E ',[0-9]{4}' |sed -E 's/,([0-9]+)\/([0-9]+)\/([0-9]+),/,\1\/\2\/\3\
/g' | sed -E 's/\/([0-9]{1})\//\/0\1\//g' | sed -E 's/\/([0-9]{1})$/\/0\1/g' | sed -E 's/^(.*),([0-9]{4}\/[0-9]{2}\/[0-9]{2})$/\2,\1/g' | sort
2016/01/01,元日
2016/01/11,成人の日
2016/02/11,建国記念の日
2016/03/20,春分の日
2016/04/29,昭和の日
2016/05/03,憲法記念日
2016/05/04,みどりの日
2016/05/05,こどもの日
2016/07/18,海の日
2016/08/11,山の日
2016/09/19,敬老の日
2016/09/22,秋分の日
2016/10/10,体育の日
2016/11/03,文化の日
2016/11/23,勤労感謝の日
2016/12/23,天皇誕生日
2017/01/01,元日
2017/01/09,成人の日
2017/02/11,建国記念の日
2017/03/20,春分の日
2017/04/29,昭和の日
2017/05/03,憲法記念日
2017/05/04,みどりの日
2017/05/05,こどもの日
2017/07/17,海の日
2017/08/11,山の日
2017/09/18,敬老の日
2017/09/23,秋分の日
2017/10/09,体育の日
2017/11/03,文化の日
2017/11/23,勤労感謝の日
2017/12/23,天皇誕生日
2018/01/01,元日
2018/01/08,成人の日
2018/02/11,建国記念の日
2018/03/21,春分の日
2018/04/29,昭和の日
2018/05/03,憲法記念日
2018/05/04,みどりの日
2018/05/05,こどもの日
2018/07/16,海の日
2018/08/11,山の日
2018/09/17,敬老の日
2018/09/23,秋分の日
2018/10/08,体育の日
2018/11/03,文化の日
2018/11/23,勤労感謝の日
2018/12/23,天皇誕生日
curl -s http://www8.cao.go.jp/chosei/shukujitsu/syukujitsu.csv | iconv -f Shift_JIS -t UTF-8 | sed -E $'s/\r//g' | grep -E ',[0-9]{4}' |sed -E 's/,([0-9]+)\/([0-9]+)\/([0-9]+),/,\1\/\2\/\3\
/g' | sed -E 's/\/([0-9]{1})\//\/0\1\//g' | sed -E 's/\/([0-9]{1})$/\/0\1/g' | sed -E 's/^(.*),([0-9]{4}\/[0-9]{2}\/[0-9]{2})$/\2,\1/g' | sort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment