diff options
author | Orangerot <purple@orangerot.dev> | 2022-12-17 01:16:18 +0100 |
---|---|---|
committer | Orangerot <purple@orangerot.dev> | 2022-12-17 01:16:18 +0100 |
commit | 6596b48113ced669b206d2e1f1e8ba6edcba88a2 (patch) | |
tree | 02c7d01783390862d989df6c91aff968e03dd415 /2022/day02/main.sh |
adv2022 first 8 days
Diffstat (limited to '2022/day02/main.sh')
-rwxr-xr-x | 2022/day02/main.sh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/2022/day02/main.sh b/2022/day02/main.sh new file mode 100755 index 0000000..08f922a --- /dev/null +++ b/2022/day02/main.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# gleichstand 3 +# gewonnen 6 +# A X=Rock 1 +# B Y=Paper 2 +# C Z=Scissors 3 +# sed -e 's/\w \(\w\)/& \1/g' -e 's/X/A/' -e 's/Y/B/' -e 's/Z/C/' \ +# -e 's/\(A A\)\|\(B B\)\|\(C C\)/3/' -e 's/\(A B\)\|\(B C\)|\(C A\)/6/' \ +# -e 's/[ABC] [ABC] //' -e 's/X/1/' -e 's/Y/2/' -e 's/Z/3/' \ +# -e 's/ /+/' /dev/stdin \ +# | paste -sd+ + +cat /dev/stdin | sed -e 's/\w \(\w\)/& \1/g' -e 's/\(A X\)\|\(B Y\)\|\(C Z\)/3/' \ + -e 's/\(A Y\)\|\(B Z\)\|\(C X\)/6/' -e 's/[ABC] [XYZ] //' -e 's/X/1/' \ + -e 's/Y/2/' -e 's/Z/3/' -e 's/ /+/' | paste -sd+ | bc |