我有一个包含以下字符串的日志文件:
2013-09-10 12:29:06 C9 T3 Update:555 Interfaces: 100 nodes: 0 ports: 0 flows: 106677
2013-09-10 12:30:07 C9 T3 Update:555 Interfaces: 100 nodes: 0 ports: 0 flows: 106281
2013-09-10 12:31:07 C9 T3 Update:555 Interfaces: 100 nodes: 0 ports: 0 flows: 108252
2013-09-10 12:32:06 C9 T3 Update:555 Interfaces: 100 nodes: 0 ports: 0 flows: 106650
2013-09-10 12:33:05 C9 T3 Update:555 Interfaces: 100 nodes: 0 ports: 0 flows: 49734
我想编写一个脚本来读取文件并仅针对流数(例如106677)进行grep,然后对它们进行求和。关于最佳方法的任何想法?我应该首先尝试仅删除流数并写入文件,然后求和?