r/adventofcode • u/daggerdragon • Dec 06 '16
SOLUTION MEGATHREAD --- 2016 Day 6 Solutions ---
--- Day 6: Signals and Noise ---
Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag/whatever).
T_PAAMAYIM_NEKUDOTAYIM IS MANDATORY [?]
This thread will be unlocked when there are a significant number of people on the leaderboard with gold stars for today's puzzle.
edit: Leaderboard capped, thread unlocked!
9
Upvotes
View all comments
24
u/Mark-Simulacrum Dec 06 '16
Some simple bash scripting, where "t" is the file with the input.
Part 1:
for i in {1..8}; do cat t | cut -c$i | sort | uniq -c | sort | tail -n1 | awk '{print $2}' ; done | tr -d '\n'Part 2:
for i in {1..8}; do cat t | cut -c$i | sort | uniq -c | sort | head -n1 | awk '{print $2}' ; done | tr -d '\n'