thank for the replies,
the awk one liner works with my example but not with my real case, i'm looking at it.
About the header I can remove it before or after inserting the lines using something like
for x number of header lines.
Daniel: all blocks consist of the same number of lines, more than 3 but always the same in a given block.dat file (also in the header i have that number) and each "break" is only a single blank line.
To go further, I also need to invert each block, i.e. obtain
I asked for a perl option, because I have a fortran program to do this now, but for portability I'm trying to learn perl scripting, sorry if I'm asking too much, maybe I have to keep writing it and come back here posting a semi working script.
anyway, an awk one liner would be of great help also.
thank for your help.