尝试捕捉两条设定线之间的某些特定线
MSG 753202显示句子(在此之间) 753202 195.1 554.2 1709.0 ...... 753203 194.8 554.4 1706.0 ...... 753257 196.9 566.0 1638.0 ...... 753262 195.8 564.4 1631.0 ...... 753263 195.8 564.1 1631.0 ...... EFIX R 753140 753263 124 195.5 555.5 1710(THIS) 753285 91.4 560.1 1614.0 ...... 753286 89.0 559.7 1612.0 ...... 753287 85.9 559.2 1610.0 ...... EFIX R 753288 753494 207 67.7 569.0 1545(THIS) 753291 73.2 559.3 1609.0 ......
MSG 753202显示(和此)
然后返回介于两者之间的行。
希望这是有道理的
答案 0 :(得分:0)
首先尝试尝试一下。我的意思是你可以根据自己的需要调整它:
sed -n '/MSG 753202 SHOWING SENTENCE/,/MSG 753202 SHOWING GONE/ { p;}' file.txt
请参阅Ranges by patterns in Sed - An Introduction and Tutorial。
测试如下:
sed -n '/MSG 753202 SHOWING SENTENCE/,/MSG 753202 SHOWING GONE/ { p;}' file.txt
MSG 753202 SHOWING SENTENCE (BETWEEN THIS) 753202 195.1 554.2 1709.0 ... 753203 194.8 554.4 1706.0 ... 753257 196.9 566.0 1638.0 ... 753262 195.8 564.4 1631.0 ... 753263 195.8 564.1 1631.0 ... EFIX R 753140 753263 124 195.5 555.5 1710 (THIS) 753285 91.4 560.1 1614.0 ... 753286 89.0 559.7 1612.0 ... 753287 85.9 559.2 1610.0 ... EFIX R 753288 753494 207 67.7 569.0 1545 (THIS) 753291 73.2 559.3 1609.0 ...
MSG 753202 SHOWING GONE (AND THIS)