jeudi 5 mars 2020

Print data in file between pattern1 and pattern2 without printing pattern2

So, I have some data that looks like this:

[SVP_VERSION_2]  
D:\CTD\01906932_2019_12_01\01906932_2019_12_01.svp  
Section 2019-335 10:55:14 18:53:56 -93:36:43  
0001.00 1539.85  
0002.00 1539.90  
0003.00 1539.83  
0004.00 1540.03  
Section 2019-335 10:55:14 18:53:56 -93:36:43  
0001.00 1540.05  
0002.00 1540.05  

I want to print the data from the first "Section" to the line before the 2nd "Section" Like so:

Section 2019-335 10:55:14 18:53:56 -93:36:43  
0001.00 1539.85  
0002.00 1539.90  
0003.00 1539.83  
0004.00 1540.03 

I know I can use:

sed -n '/Section/,/Section/p' file 

to get:

Section 2019-335 10:55:14 18:53:56 -93:36:43  
0001.00 1539.85  
0002.00 1539.90  
0003.00 1539.83  
0004.00 1540.03  
Section 2019-335 10:55:14 18:53:56 -93:36:43  

but I want to strip off the trailing "Section" line. I also know that I can pipe the output to a second sed to delete the last line, but I'm hoping to only make one call to sed. Is that possible?

Aucun commentaire:

Enregistrer un commentaire