I have three files in a folder.
File A have 700 lines, made up of 100 data blocks. Each datablock have 5 lines. First line has the total number of lines per datablock, 2nd line is empty, and 3~7th line are data.
5
AA 356djs 225gsd 1245gr
BB 123asd 123asd 123asd
CC TToptg TToptg gngngn
DD sIG123 gjn123 uot123
EE 166131 100021 205011
5
AA 356djs 225gsd 1245gr
BB 123asd 123asd 123asd
CC TToptg TToptg gngngn
DD sIG123 gjn123 uot123
EE 166131 100021 205011
.... (repeating until 100th data block)
File B is similar with A, but a bit different. It has 300 total lines, made up of 100 datablocks, each datablock has 3 lines
3
LL lplplp 122121 aggagg
KK hbnkio ohgimp 125125
TT KGNskg fgnjdg 125154
3
LL lplplp 122121 aggagg
KK hbnkio ohgimp 125125
TT KGNskg fgnjdg 125154
.... (repeating until 100th data block)
File C is also similar. 400 lines total, made up of 100 datablocks, each datablock has 4 lines
4
PP ginini 216361 sgdaga
ZZ gonhon q215ag hagqgq
RR TKEMMM 125sdg 125961
II tninks 150121 192u9u
4
PP ginini 216361 sgdaga
ZZ gonhon q215ag hagqgq
RR TKEMMM 125sdg 125961
II tninks 150121 192u9u
.... (repeating until 100th data block)
I hope to stack up those 3 files to single file, datablock by datablock. So the results will have total 1200 lines, made up of 100 datablocks, each datablock has 12 lines, and should be look like
12
AA 356djs 225gsd 1245gr
BB 123asd 123asd 123asd
CC TToptg TToptg gngngn
DD sIG123 gjn123 uot123
EE 166131 100021 205011
LL lplplp 122121 aggagg
KK hbnkio ohgimp 125125
TT KGNskg fgnjdg 125154
PP ginini 216361 sgdaga
ZZ gonhon q215ag hagqgq
RR TKEMMM 125sdg 125961
II tninks 150121 192u9u
12
AA 356djs 225gsd 1245gr
BB 123asd 123asd 123asd
CC TToptg TToptg gngngn
DD sIG123 gjn123 uot123
EE 166131 100021 205011
LL lplplp 122121 aggagg
KK hbnkio ohgimp 125125
TT KGNskg fgnjdg 125154
PP ginini 216361 sgdaga
ZZ gonhon q215ag hagqgq
RR TKEMMM 125sdg 125961
II tninks 150121 192u9u
.... (repeating until 100th data block)
If it were stacking up of 3 files at all, it is very easy, since I can use cat command. But this is different.... How can I do this stacking up of files, by each data blocks, like the example above? Can I use awk command or cat command? Fortran or python methods are also welcome.
Thanks
Best,