The most elegant solution would probably be using a script. I'm not a JavaScript guy, so I can't show you how to do that (I prefer Python for this kind of work).
But you could also do it using a macro. The only conditions are:
1. The first header has to be longer than all following lines of the first section, or characters will get mixed. After that, line lengths don't matter. (It's possible to augment the macro so that line lengths don't matter for the first section, but let's not get carried away now
)
2. There has to be an empty line at the end. Otherwise the macro will never stop.
This macro works on an example file where each section including headers is four lines long:
Code: Select all
InsertMode
ColumnModeOff
HexOff
Loop 0
Key Ctrl+HOME
Key DOWN ARROW
Key DOWN ARROW
Key DOWN ARROW
Key DOWN ARROW
IfEof
ExitLoop
EndIf
StartSelect
Key DOWN ARROW
Key DOWN ARROW
Key DOWN ARROW
Key DOWN ARROW
EndSelect
Cut
Key Ctrl+HOME
Key END
" "
ColumnModeOn
Paste
ColumnModeOff
EndLoop
For more lines, add more "Key DOWN ARROW" lines.
This macro will transform
Code: Select all
header A
data 1ad
data 2a
...
header B
datatest 1b
data 2b
...
header C
data 1c
datalonger 2c
...
header D
data 1d
data 2d
...
to
Code: Select all
header A header B header C header D
data 1ad datatest 1b data 1c data 1d
data 2a data 2b datalonger 2c data 2d
... ... ... ...