main.sh (121B)
1 #!/bin/sh 2 paste -sd+ /dev/stdin | sed 's/++/\n/g' | bc | sort -n 3 # ./main.sh < input2.txt | tail -3 | paste -sd+ - | bc