示例文件:list.txt
ABC|DEF|March11,2017|11:00|1
ABC|DEF|March11,2017|11:10|1
ABC|DEF|March11,2017|11:20|0
DEF|TRO|March11,2017|11:30|0
DEF|TRO|March11,2017|11:40|1
DEF|TRO|March11,2017|11:50|0
RFR|TRO|March11,2017|12:00|0
DAEF|TRO|March11,2017|12:10|4
DSDEF|TRO|March11,2017|12:20|2
DScEF|TRO|March11,2017|12:30|1
DCDEF|TRO|March11,2017|12:40|0
DE34F|TRO|March11,2017|12:50|0
DESDF|TRO|March11,2017|13:00|0
我想计算$5
位置ne 0
的行,直到$5
变为0,方法是打印shell中的第一个匹配行($0
)
Ex:o / p应为
ABC|DEF|March11,2017|11:00|1 - 2(rows)
DEF|TRO|March11,2017|11:40|1 - 1 (rows)
DAEF|TRO|March11,2017|12:10|4 - 3(rows)