# If you'd like to omit non-matching lines from the result; add ';d' to the end of the expression.
sed -E 's/\n1 XXXX.*(\n[2-9].*)*//mg;t' <<< "0 @I10@ INDI
1 XXXX Alena /Boudová/
2 TYPE birth
2 GIVN Alena
2 SURN Bouda
1 SEX F
1 BIRT
2 DATE 1950
2 PLAC Dolní Lhota, Královéhradecký, Česko
3 _LOC @X866@
1 OCCU dělnice
1 FAMS @F187@
1 FAMC @F146@
1 CHAN
2 DATE 19 OCT 2015
3 TIME 20:29:06
2 _WT_USER admin
1 XXXX Alena /Kuklová/
2 TYPE married
2 GIVN Alena
2 SURN Kukl"
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for SED, please visit: https://www.gnu.org/software/sed/manual/html_node/The-_0022s_0022-Command.html