I have a large .fna file containing millions of DNA sequences. Due to some write errors after truncating my primers, I'm left with some sequence headers with no sequence following it. An example is shown below. I need to delete these headers as well as the empty lines so I can continue with my workflow scripts.
B2S312_20116609 HWI-ST1128:217:D2HB4ACXX:8:1101:20814:45721 orig_bc=CCGCATAA new_bc=CCGCATAA bc_diffs=0
AACCATGCACCACCTGTATCTGTGTCTAACCAAAGGTCAGAACAACACAATCTCTTGTGTCCTCACAGTATGTCAAGACTT
B4S315_20116610 HWI-ST1128:217:D2HB4ACXX:8:1101:20948:45746 orig_bc=ATATGCCG new_bc=ATATGCCG bc_diffs=0
AACCATGCACCACCTGCACACGACCAACTAAATGCCACCACATCTCTGCAGTGTCGCCGTGCATGTCAAGCCTT
A3C214_20116611 HWI-ST1128:217:D2HB4ACXX:8:1101:20874:45747 orig_bc=GATCCAAC new_bc=GATCCAAC bc_diffs=0
A2C214_20116612 HWI-ST1128:217:D2HB4ACXX:8:1101:21248:45534 orig_bc=CCTAGGAT new_bc=CCTAGGAT bc_diffs=0
AACCGTGCACCACCTGTTTTCTGGCTTCCGAAGAAGAGGAACTATCTCTAGTTCTGTCCATCAATGTCAAGACCT
So in this example I would want to remove the A3C214_20116611 HWI-ST1128:217:D2HB4ACXX:8:1101:20874:45747 orig_bc=GATCCAAC new_bc=GATCCAAC bc_diffs=0
line and the empty line below it.
I've managed to only delete the empty line using sed, but cannot find an example that is suitable for my scenario.
sed '/bc_diffs=0\s*$/{N;d}' file.fna
{}
) rather than the one for quotes (marked by"
).