From a2ce7bb47964e226d4b10b791a038ca1f1fa67d7 Mon Sep 17 00:00:00 2001 From: Brett Parker Date: Mon, 7 Dec 2020 19:27:48 +0000 Subject: [PATCH 1/1] Add some one liners to other_ways for day5 --- day5/other_ways.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 day5/other_ways.txt diff --git a/day5/other_ways.txt b/day5/other_ways.txt new file mode 100644 index 0000000..62ea744 --- /dev/null +++ b/day5/other_ways.txt @@ -0,0 +1,3 @@ +Getting last seat id: cat input.txt | sed -e 's#[FL]#0#g; s#[BR]#1#g;' | sort | tail -n 1 | (read x; echo $((2#$x))) + +Getting my seat id: cat input.txt | sed 's|[FL]|0|g; s|[BR]|1|g' | sort | sed -ne '1 { x; }; 2,$ { H; x; s#\n#-#g; /10-/ { s#^.*-##; /00$/ {p; q} }; /01-/ { s#^.*-##; /11$/ {p; q; } }; /11-/ { s#^.*-##; /01$/ {p; q; } }; s#^.*-##; x; }' | ( read x; echo $((2#$x - 1)) ) -- 2.39.5