Skip to content

Latest commit

 

History

History
38 lines (31 loc) · 820 Bytes

README.md

File metadata and controls

38 lines (31 loc) · 820 Bytes

aoc2019

Parsing of inputs:

Use

curl -sb session=<token> https://adventofcode.com/2019/day/<day>/input

with valid <token> and <day>, then pipe with sed command of the day.

Day1

sed ':a;N;$!ba;s/\n/\x20/g;s/^/\(define input \x27\(/;s/$/\)\)/'

Day2

sed 's/\x2C/\x20/g;s/^/\(define input \x27\(/;s/$/\)\)/'

Day3

sed -r ':a;N;$!ba;s/([U,D,L,R])([0-9]+)/\(\#\\\1 \2\)/g;s/\x2C/\x20/g;s/(.*)\n(.*)/\(define wire-one \x27\(\1\)\)\n\n\(define wire-two \x27\(\2\)\)/'

Day4

sed 's/\x2D/\x20/;s/^/\(define input \x27\(/;s/$/\)\)/'

Day5

sed 's/\x2C/\x20/g;s/^/\(define input \x27\(/;s/$/\)\)/'

Day6

sed -r ':a;N;$!ba;s/(.{3})[)](.{3})/\(\x22\1\x22 \x22\2\x22\)/g;s/\n/\x20/g;s/^/\(define input \x27\(/;s/$/\)\)/'