I have a file which looks like:
blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah
<empty line here>
Total DOS and NOS and partial (IT) DOSDOWN
<empty line here>
E Total 1
<empty line here>
-1.5000 0.004 0.000 0.004
-1.4953 0.004 0.000 0.004
-1.4906 0.004 0.000 0.004
-1.4859 0.004 0.000 0.004
-1.4812 0.004 0.000 0.004
0.3563 0.708 5.510 0.708
0.3609 0.562 5.513 0.562
0.3656 0.381 5.515 0.381
0.3703 0.149 5.517 0.149
<empty line here>
Sublattice 1 Atom Fe spin DOWN
What I want is to extract all lines between (first pattern)
Total DOS and NOS and partial (IT) DOSUP
<empty line here>
E Total 1
<empty line here>
and (second pattern)
<empty line here>
Sublattice 1 Atom Fe spin DOWN
i.e. I want to get
-1.5000 0.004 0.000 0.004
-1.4953 0.004 0.000 0.004
-1.4906 0.004 0.000 0.004
-1.4859 0.004 0.000 0.004
-1.4812 0.004 0.000 0.004
0.3563 0.708 5.510 0.708
0.3609 0.562 5.513 0.562
0.3656 0.381 5.515 0.381
0.3703 0.149 5.517 0.149
So, at the end of the day I want to have lines between two multiline patterns.
As I understand awk
can detect multiline patterns via state machine (see here), but I failed to do it in my case.
Any suggestion how to resolve this problem would be very much appreciated.