Extract lines between 2 tokens in a text file using bash

后端 未结 7 755
死守一世寂寞
死守一世寂寞 2020-12-05 07:26

i have a text file which looks like this:

random useless text 
 
para1 
para2 
para3 
 
random us         


        
7条回答
  •  误落风尘
    2020-12-05 08:20

    You can extract it, including the tokens with sed. Then use head and tail to strip the tokens off.

    ... | sed -n "/this is token 1/,/this is token 2/p" | head -n-1 | tail -n+2

提交回复
热议问题