AdventOfCode2022/1/day1-2.sh
2022-12-03 01:33:53 +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}'