脚本自动计算文本框得值
How to calculate the average of value in lines of a text file on Linux by a script?
The file.txt is like:
file.txt就像:
Run 0: Time used: 22.235331711 seconds.
Run 1: Time used: 20.784491219 seconds.
Run 2: Time used: 21.851638876 seconds.
What I want it to calculate the average time.
我想要它来计算平均时间。
awk
is handy for this purpose:
为此, awk
方便:
awk '{ total += $5; count++ } END {print total/count }' file.txt
Answered by Eric Z Ma.
埃里克·马(Eric Z Ma)回答。
脚本自动计算文本框得值