regex - Bash, grep between two lines with specified string -


example:

a43 test1 abc cvb bnm test2 kfo 

i need lines between test1 , test2. normal grep not work in case. have propositions?

her awk these print test1 test2

awk '/test1/{f=1} /test2/{f=0;print} f' awk '/test1/{f=1} f; /test2/{f=0}'  awk '/test1/,/test2/' 

test1 abc cvb bnm test2 

these prints data between test1 test2

awk '/test1/{f=1;next} /test2/{f=0} f'  awk '/test2/{f=0} f; /test1/{f=1}'  

abc cvb bnm 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -