aboutsummaryrefslogtreecommitdiff
path: root/2015/16/puzzle-2.sh
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2022-11-30 12:23:17 +0100
committerThomas Voss <mail@thomasvoss.com> 2022-11-30 12:23:17 +0100
commitf3e3e3e354b87f4ce27bd74bf14cec05d06974b6 (patch)
tree112352e9c3ba5d5d924036def2b5f853d3f8dc28 /2015/16/puzzle-2.sh
parent4742dd73046c53cff7fe54deee58358c3b193206 (diff)
Lots of cleanup and stuff
Diffstat (limited to '2015/16/puzzle-2.sh')
-rwxr-xr-x2015/16/puzzle-2.sh40
1 files changed, 20 insertions, 20 deletions
diff --git a/2015/16/puzzle-2.sh b/2015/16/puzzle-2.sh
index e854c7c..92e6f9d 100755
--- a/2015/16/puzzle-2.sh
+++ b/2015/16/puzzle-2.sh
@@ -1,26 +1,26 @@
-#!/usr/bin/env sh
+#!/bin/sh
# Definitely there is a better way to do this, but this is fine
# Original solution was just me using regex in vim lol
-sed '/children/!s/$/, children: 3/' input \
- | sed '/cats/!s/$/, cats: 8/' \
- | sed '/samoyeds/!s/$/, samoyeds: 2/' \
+sed '/children/!s/$/, children: 3/' input \
+ | sed '/cats/!s/$/, cats: 8/' \
+ | sed '/samoyeds/!s/$/, samoyeds: 2/' \
| sed '/pomeranians/!s/$/, pomeranians: 2/' \
- | sed '/akitas/!s/$/, akitas: 0/' \
- | sed '/vizslas/!s/$/, vizslas: 0/' \
- | sed '/goldfish/!s/$/, goldfish: 4/' \
- | sed '/trees/!s/$/, trees: 4/' \
- | sed '/cars/!s/$/, cars: 2/' \
- | sed '/perfumes/!s/$/, perfumes: 1/' \
- | sed 's/$/ /' \
- | grep 'children: 3' \
- | grep 'samoyeds: 2' \
- | grep 'akitas: 0' \
- | grep 'vizslas: 0' \
- | grep 'cars: 2' \
- | grep 'perfumes: 1' \
- | grep 'goldfish: [0-4][ ,]' \
- | grep 'pomeranians: [0-2][ ,]' \
- | grep 'cats: \([8-9]\|[1-9][0-9]\)' \
+ | sed '/akitas/!s/$/, akitas: 0/' \
+ | sed '/vizslas/!s/$/, vizslas: 0/' \
+ | sed '/goldfish/!s/$/, goldfish: 4/' \
+ | sed '/trees/!s/$/, trees: 4/' \
+ | sed '/cars/!s/$/, cars: 2/' \
+ | sed '/perfumes/!s/$/, perfumes: 1/' \
+ | sed 's/$/ /' \
+ | grep 'children: 3' \
+ | grep 'samoyeds: 2' \
+ | grep 'akitas: 0' \
+ | grep 'vizslas: 0' \
+ | grep 'cars: 2' \
+ | grep 'perfumes: 1' \
+ | grep 'goldfish: [0-4][ ,]' \
+ | grep 'pomeranians: [0-2][ ,]' \
+ | grep 'cats: \([8-9]\|[1-9][0-9]\)' \
| sed -n '/trees: \([4-9]\|[1-9][0-9]\)/s/Sue \([0-9]*\).*/\1/p'