Привет,
У меня файл, вроде следующего:
Код:
Starting to process segment 0 (and symmetry related segments)
Number of (cancelled) singularities: 0
Number of (cancelled) negative numerators: 0
Segment 0: 5.49secs
Starting to process segment 1 (and symmetry related segments)
Number of (cancelled) singularities: 0
Number of (cancelled) negative numerators: 0
Segment 1: 10.01secs
Starting to process segment 2 (and symmetry related segments)
Number of (cancelled) singularities: 0
Number of (cancelled) negative numerators: 0
Segment 2: 7.82secs
Starting to process segment 3 (and symmetry related segments)
Number of (cancelled) singularities: 0
Number of (cancelled) negative numerators: 0
Segment 3: 5.31secs
... и я бы хотел, чтобы извлечь информацию о времени. Я хотел бы прочитать этот файл, сохраните время (в каждой строке) на переменную, удалите суффикс секунды, а затем добавить его к предыдущей стоимости. В результате будет общее время ....
Я пробовал многие вещи, но никто из них не работает ... В случае, оно помогает, последний из которых я попытался было
Код:
TIME="`awk '/Segment/ {print $3%secs + $TIME} ' log.txt`"
echo $TIME
Это глупое решение, но я думаю, он может передать то, что я хочу ....
Я подозреваю, что это что-то делать с чтением каждой строки separetely, но я не могу понять его ...
Спасибо заранее ...