From 17599f4fe7e8d0e54e3f015c24c0fd7c477e2dfd Mon Sep 17 00:00:00 2001 From: "matthias@arch" Date: Sat, 3 Dec 2022 01:33:29 +0100 Subject: [PATCH] added task 2 --- 1/README.md | 6 ++++-- 1/day1.awk | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) delete mode 100755 1/day1.awk diff --git a/1/README.md b/1/README.md index 0161a4c..f21b36c 100644 --- a/1/README.md +++ b/1/README.md @@ -1,6 +1,8 @@ # Day 1 -Get maximum number of calories an Elf carries ```shell -awk -f day1.awk input.txt +# Find the Elf carrying the most Calories. How many total Calories is that Elf carrying? +awk -f day1-1.awk input.txt +# Find the top three Elves carrying the most Calories. How many Calories are those Elves carrying in total? +./day1.2.sh ``` diff --git a/1/day1.awk b/1/day1.awk deleted file mode 100755 index 7c763d4..0000000 --- a/1/day1.awk +++ /dev/null @@ -1 +0,0 @@ -BEGIN{sum=0; max_sum=0} {if (NF != 0) {sum+=$1} else {if (sum > max_sum) {max_sum=sum}; sum=0}} END{print max_sum}