这是我的意见:
time1 start a
time2 start b
time3 start a
time4 end a
time5 end b
time6 start a
time7 end a
time8 end a
我想提供以下内容:
time1 time4 a
time2 time5 b
time3 time7 a
time6 time8 a
由于
答案 0 :(得分:1)
$ awk '$2=="start"{s[$3,++sc[$3]]=$1} $2=="end"{print s[$3,++ec[$3]],$1,$3}' file
time1 time4 a
time2 time5 b
time3 time7 a
time6 time8 a