thomas_2023/day_1/part1.fish

13 lines
237 B
Fish
Executable file

set sum 0
for line in $(cat input.txt)
set first $(string match -gr "(\d)" $line)
set last $(string match -gr "(\d)(?!.*\d)" $line)
echo $line
set n $first$last
set sum $(math $sum + $n)
echo "-"
end
echo $sum