Last active
December 5, 2022 01:56
-
-
Save rwcitek/aaa1720f1cd4ea7c8d50182b769e7b36 to your computer and use it in GitHub Desktop.
Advent of Code 2022 - day 01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using a shell pipeline of awk, bc, sort, head in Docker with the Alpine image | |
<<'eof' docker container run --rm -i alpine | |
{ cat <<'eof2' | |
1000 | |
2000 | |
3000 | |
4000 | |
5000 | |
6000 | |
7000 | |
8000 | |
9000 | |
10000 | |
eof2 | |
} | | |
awk -v RS='\n\n' '{ gsub("\n","+") } ; { print }' | | |
bc | | |
cat -n | | |
sort -k2,2nr | | |
head -1 | |
eof | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment