AWK Command parse a file based on string.

AWK Command parse a file based on string.
I am trying to write a shell script to parse a file based on a string and move the content of the file to another file.

Here is scenario.
File content below

Mime-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_1041_211815584.1323469617525"
X-Edel-MessageId: E76F5EEF-AC2D-482B-902C-D3A7A72D
X-Edel-MessageSent: fbd435be-8007-4a32-ac18-758ddea10b5a
------=_Part_1041_211815584.1323469617525

I wrote a awk command to break the file based on the below string.
X-Edel-MessageSent
awk -v fname=$filename '/X-Edel-MessageSent:/{i++}{print > i+1"-"fname}' filename.txt

Issue i am facing:- When I used the above command file is getting split into two files.
File1:-
Mime-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_1041_211815584.1323469617525"
X-Edel-MessageId: E76F5EEF-AC2D-482B-902C-D3A7A72D

File2:-
X-Edel-MessageSent: fbd435be-8007-4a32-ac18-758ddea10b5a
------=_Part_1041_211815584.1323469617525

But I need the files in the below way:-

File1:-
Mime-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_1041_211815584.1323469617525"
X-Edel-MessageId: E76F5EEF-AC2D-482B-902C-D3A7A72D
X-Edel-MessageSent: fbd435be-8007-4a32-ac18-758ddea10b5a

File2:-
------=_Part_1041_211815584.1323469617525

Your help is greatly appreciated.

:wall:

Very very close. Print first, then increment.

awk -v fname=$filename '{print > i+1"-"fname};  /X-Edel-MessageSent:/{i++}' filename.txt

Thanks a bunch. It worked.