diff options
author | June McEnroe <june@causal.agency> | 2019-12-04 02:42:48 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-11-22 00:14:26 -0500 |
commit | 85a3d8d7dbb6ec9d09d15123d5e3953f1c97350d (patch) | |
tree | 77518ffd48d4a7d9564b13e0f882aadbbb705ca4 | |
parent | Solve day 4 part 2 (diff) | |
download | aoc-85a3d8d7dbb6ec9d09d15123d5e3953f1c97350d.tar.gz aoc-85a3d8d7dbb6ec9d09d15123d5e3953f1c97350d.zip |
Add alternate shell solution for day 4
-rw-r--r-- | 2019/day04.sh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/2019/day04.sh b/2019/day04.sh new file mode 100644 index 0000000..6cd264a --- /dev/null +++ b/2019/day04.sh @@ -0,0 +1,11 @@ +IFS=- +read min max +seq "$min" "$max" \ + | grep '^1*2*3*4*5*6*7*8*9*$' \ + | grep -E '00|11|22|33|44|55|66|77|88|99' \ + | wc -l +seq "$min" "$max" \ + | grep '^1*2*3*4*5*6*7*8*9*$' \ + | sed 's/.*/x&x/' \ + | grep -E '[^0]00[^0]|[^1]11[^1]|[^2]22[^2]|[^3]33[^3]|[^4]44[^4]|[^5]55[^5]|[^6]66[^6]|[^7]77[^7]|[^8]88[^8]|[^9]99[^9]' \ + | wc -l |