Вы можете сделать это с помощью GNU dc
следующим образом:
< new_file.txt tr -- - _ | dc -e "[q]sq [?z1=qrd1<qrn32anp0.005+dd=?]s? 0l?x"
dc -e '
# macro for quitting
[q]sq
# macro to read next line and perform operations
[
? z1=q # read next line and quit when it is empty. The 1 is apriori
r # else, reverse the stack elements so that sum is top of stack now
d1<q # quit if current sum is more than 1
r # else, reverse the stack elements so that line is top of stack now
n 32an p # print the line, space (32a is ascii decimal for space), & print current sum
0.005+ # update the current sum for next round
dd=? # recursively invoke itself for more.... its a loop essentially
]s?
# initialize stack and start operations
0 l?x
'
Что касается вывода из Linux (а не вашего загрузчика, то есть U-Boot или, возможно, чего-то более раннего), вы просто измените параметр командной строки console =
, см. http: // elinux.org/Serial_console и https://www.kernel.org/doc/Documentation/admin-guide/kernel-parameters.txt .