With GNU awk for multi-char RS:
$ awk -v RS='(^|\n)=+\n' 'NR==2' file
v2.0.0
Added feature 3
Added feature 4
With any other awk the equivalent would be lengthier:
$ awk '
/^=+$/ { prt(); next }
{ rec=rec $0 ORS }
END { prt() }
function prt() { if (++nr==2) printf "%s", rec; rec="" }
' file
v2.0.0
Added feature 3
Added feature 4
Note that the above will work to print any number of record, not just the 2nd one, just by changing 2 to whatever record number you want printed and you can trivially add/change conditions like only printing the record if it contains some string instead of or in addition to based on the record number, e.g. to print the 17th record if it contains foo
:
awk -v RS='(^|\n)=+\n' 'NR==17 && /foo/' file
Explanation: Your records are separated by ===
lines so set the Record Separator RS
to a regexp that matches that description, then just print the record when the Number of Records (NR
) reaches the number you want, i.e. 2 (because there's a null record before the first ===
line).