#!/bin/bash set -eu set -o pipefail DAY=$1 CURLOPTS=--no-progress-meter curl $CURLOPTS https://adventofcode.com/2022/day/$DAY | awk '/
/ {sub("
", ""); CODE=1; IDX+=1} /<\/code>/ {CODE=0;} {if (CODE) print > sprintf("ex%d.in", IDX)}'
curl $CURLOPTS -b ../cookie https://adventofcode.com/2022/day/$DAY/input > real.in
echo "done :)"