in reply to Re^3: Replace first blank line in a text file with headers.
in thread Replace first blank line in a text file with headers.
Should be pretty easy.
Just open a new output file, print your header to it.
Then cycle through your input file, skipping all blank lines.
Then close your output file.