|
@ -5,7 +5,7 @@ while read line; do |
|
|
num1="$(echo "$line" | sed -n 's/^[^0-9]*\([0-9]\).*/\1/p')" |
|
|
num1="$(echo "$line" | sed -n 's/^[^0-9]*\([0-9]\).*/\1/p')" |
|
|
num2="$(echo "$line" | sed -n 's/.*\([0-9]\)[^0-9]*$/\1/p')" |
|
|
num2="$(echo "$line" | sed -n 's/.*\([0-9]\)[^0-9]*$/\1/p')" |
|
|
sum=$(( $sum + $num1$num2 )) |
|
|
sum=$(( $sum + $num1$num2 )) |
|
|
done < d01_input.txt |
|
|
done < "$1" |
|
|
echo "$sum" |
|
|
echo "$sum" |
|
|
|
|
|
|
|
|
sum=0 |
|
|
sum=0 |
|
@ -35,5 +35,5 @@ while read line; do |
|
|
num1="$(echo "$line1" | sed -n 's/^[^0-9]*\([0-9]\).*/\1/p')" |
|
|
num1="$(echo "$line1" | sed -n 's/^[^0-9]*\([0-9]\).*/\1/p')" |
|
|
num2="$(echo "$line2" | sed -n 's/.*\([0-9]\)[^0-9]*$/\1/p')" |
|
|
num2="$(echo "$line2" | sed -n 's/.*\([0-9]\)[^0-9]*$/\1/p')" |
|
|
sum=$(( $sum + $num1$num2 )) |
|
|
sum=$(( $sum + $num1$num2 )) |
|
|
done < d01_input.txt |
|
|
done < "$1" |
|
|
echo "$sum" |
|
|
echo "$sum" |
|
|