AdventOfCode2022/01/day1-2.sh
2022-12-11 02:26:42 +01:00

3 lines
158 B
Bash
Executable File

#!/bin/bash
awk 'BEGIN{sum=0} {if (NF != 0) {sum+=$1} else {print sum; sum=0}}' input.txt | sort -n | tail -n 3 | awk 'BEGIN{sum=0} {sum+=$1} END{print sum}'