aboutsummaryrefslogtreecommitdiff
path: root/2015/12/puzzle-2.sh
blob: b941678105df65599ae62ee42c9d5501fdd4dba2 (plain) (blame)
1
2
3
4
5
6
7
#!/bin/sh

jq 'walk(if type == "object" then del(select(.[] == "red")) else . end)' input \
	| tr -c '\-0-9' '\n'                                                   \
	| grep .                                                               \
	| paste -sd+                                                           \
	| bc