aboutsummaryrefslogtreecommitdiff
path: root/2024/03/puzzle-1.sh
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-12-03 12:25:52 +0100
committerThomas Voss <mail@thomasvoss.com> 2024-12-03 12:25:52 +0100
commit2586844a875720703e614138297f10e45ce94735 (patch)
treefba9fa0f4c8bd6662c936d1d008ce1c51ff1dc95 /2024/03/puzzle-1.sh
parent5efcc8160c38889eaa70cf2f10089e9d2d1450b5 (diff)
Add 2024 day 3 solutions
Diffstat (limited to '2024/03/puzzle-1.sh')
-rwxr-xr-x2024/03/puzzle-1.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/2024/03/puzzle-1.sh b/2024/03/puzzle-1.sh
new file mode 100755
index 0000000..c0f2f38
--- /dev/null
+++ b/2024/03/puzzle-1.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+grep -Eo 'mul\([0-9]+,[0-9]+\)' input \
+| awk 'BEGIN { FPAT = "[0-9]+" }
+ { x += $1 * $2 }
+ END { print x }
+' \ No newline at end of file