Skip to content

Instantly share code, notes, and snippets.

@rhowe
Created February 20, 2020 17:15
Show Gist options
  • Save rhowe/8bca5487d4e1ed1dcaec109096e83e41 to your computer and use it in GitHub Desktop.
Save rhowe/8bca5487d4e1ed1dcaec109096e83e41 to your computer and use it in GitHub Desktop.
AOC2019day4part2
#!/bin/bash
set -eu
set -o pipefail
thisisfine=$(seq 0 9 | sed 's/.*/^&&[^&]|[^&]&&[^&]|[^&]&&$/' | xargs | tr \ \|)
seq "${1%-*}" "${1#*-}" \
| grep -Ev '10|2[01]|3[0-2]|4[0-3]|5[0-4]|6[0-5]|7[0-6]|8[0-7]|9[0-8]' \
| grep -cE "$thisisfine"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment