103
SOLUTION MEGATHREAD-π- 2022 Day 2 Solutions -π-(self.adventofcode)
submitted 3 years, 1 month ago* (edited 4 days, 4 hours after) by daggerdragon to /r/adventofcode (134.8k)
NEW AND NOTEWORTHY
- All of our rules, FAQs, resources, etc. are in our [community wiki](/r/adve...
since 3 years, 1 month ago
6 of 6
Tip Reveddit Real-Time can notify you when your content is removed.
your account history
Tip Check if your account has any removed comments.
view my removed comments you are viewing a single comment's thread.
view all comments


AWK
Part 1
Part 2
Awk is actually really good for this because it's really tailor made for cases like this, when you need to patternmatch on a stream of lines :)
Awk is fantastic for AOC. Lots of puzzles have easy awk solutions.
By the way, do you know by any chance (except maybe the infopages) any learning resources for AWK? I only really know about BEGIN{}, {} and END{} blocks (I learned about awk's regex feature because of your post though).
You can read the POSIX awk manual page. If you have posix manpages installed itβs
man 1p awk. If you have GNU awk installed you can read the gawk manual. I prefer the HTML version (just google βgawk manualβ online) but you can also use infopages if you hate yourself.Unfortunately I donβt really know any other good source :/
Please edit your post to format your code with the backwards-compatible Markdown syntax instead so your code is easier to read on old.reddit and mobile apps.