Perl is ideally suited to this... following is untested, but should work.
Edit: Modified to read a fixed file.
#!/usr/bin/perl
open IN, "< this_is_input";
open OUT, "> before_ER";
while(<><IN>) {
if(/^\d+\sER\s\d+/$) {
# Line containing <number><spaces>ER<spaces><number> only
chomp;
close OUT;
open OUT, "> $_";
}
else {
print $OUT;
}
}