diff options
author | Thomas Voss <thomasvoss@live.com> | 2021-10-29 23:02:39 +0200 |
---|---|---|
committer | Thomas Voss <thomasvoss@live.com> | 2021-10-29 23:02:39 +0200 |
commit | e7c9108b95e39d7ea5a29ae06d619c4727f11027 (patch) | |
tree | 237261eef3afd0720be77dbcbb9599fa66a24b67 /2015/16/puzzle-1.sh |
Initial commit
Diffstat (limited to '2015/16/puzzle-1.sh')
-rwxr-xr-x | 2015/16/puzzle-1.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/2015/16/puzzle-1.sh b/2015/16/puzzle-1.sh new file mode 100755 index 0000000..3550231 --- /dev/null +++ b/2015/16/puzzle-1.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env 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: 7/' \ + | sed '/samoyeds/!s/$/, samoyeds: 2/' \ + | sed '/pomeranians/!s/$/, pomeranians: 3/' \ + | sed '/akitas/!s/$/, akitas: 0/' \ + | sed '/vizslas/!s/$/, vizslas: 0/' \ + | sed '/goldfish/!s/$/, goldfish: 5/' \ + | sed '/trees/!s/$/, trees: 3/' \ + | sed '/cars/!s/$/, cars: 2/' \ + | sed '/perfumes/!s/$/, perfumes: 1/' \ + | grep 'children: 3' \ + | grep 'cats: 7' \ + | grep 'samoyeds: 2' \ + | grep 'pomeranians: 3' \ + | grep 'akitas: 0' \ + | grep 'vizslas: 0' \ + | grep 'goldfish: 5' \ + | grep 'trees: 3' \ + | grep 'cars: 2' \ + | sed -n '/perfumes: 1/s/Sue \([0-9]*\).*/\1/p' |