From 3f67d3091d469f14edc6f3b578c8e664d7214705 Mon Sep 17 00:00:00 2001 From: setop Date: Sun, 4 Dec 2022 10:25:08 +0100 Subject: [PATCH] day 4, easy --- d04/part1.awk | 3 +++ d04/part2.awk | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 d04/part1.awk create mode 100644 d04/part2.awk diff --git a/d04/part1.awk b/d04/part1.awk new file mode 100644 index 0000000..4f139bc --- /dev/null +++ b/d04/part1.awk @@ -0,0 +1,3 @@ +# awk -F ',|-' -f part1.awk input +($3>=$1 && $4<=$2) || ($1>=$3 && $2<=$4) {n++} +END {print n} diff --git a/d04/part2.awk b/d04/part2.awk new file mode 100644 index 0000000..ce52f97 --- /dev/null +++ b/d04/part2.awk @@ -0,0 +1,3 @@ +# awk -F ',|-' -f part2.awk input +$3>$2 || $1 > $4 {n++} +END {print NR-n}