bash - How can I remove specific lines from each datablock? -


i have repeating dataset looks

700 block1 1    2  b  b  b c  3  4  5  d  6  8 10 .... ff dd 22 11  700 block2 1  b  b  b c  d  f  q .... 

the file made of 100 data blocks, , each data block have 702 lines. first line of each data block number of data (=700), , second line of each data block number of data block.

here, hope remove 3rd ~ 100th line every data block (this remove 98 lines), left 101th ~ 700th line in each data block. there way in sed or grep? need use loop?

i know how remove lines specific patter using grep -v , sed, couldn't find how delete multiple lines inside each data block.

this might work (gnu sed):

sed '/^700$/,+1p;//,+99d' file 

print lines want , delete lines don't.


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -