pathfinderpathfinder
Technical User
Hi everybody,
First post here. I put all my hopes here, I m running out of time to get a file, and can t go further now, there s something wrong in my files.
I used a lot of times this instruction
paste M1_CGK025_K1K2K3T0T1T2T3.dat M1_CGK025_ITSIM.dat | awk 'BEGIN{OFS=" "};NF==9 {for (i=1; i<=NF; i++) printf ("%s ", $i);printf("\n") }' > M1_CG_K025_KTITSIM.dat
first file has 7 columns, 2nd file has 2 columns.
I wanted to paste both files, in a newfile (output file) of 9 columns
(50 lines in each of the files)
This works really well: the resulting file, M1_CG_K025_KTITSIM.dat (let s call it fileA) opened in matlab gives me a nice 50 * 9 matrix.
Now, I have another file, fileB. I can open it in matlab again with a simple load instruction, and it has 50 *8287 elements.
OK. So I want to repeat the same instruction, with paste and awk, to have a brand new fileC, whose ideal size loaded in matlab should be 50* (8287+9).
So i paste the last instruction:
paste fileA fileB | awk 'BEGIN{OFS=" "};NF==8296 {for (i=1; i<=NF; i++) printf ("%s ", $i);printf("\n") }' > fileC.dat
It seems to work, but actually matlab doesn t accept a LOAD on it, as it pretends the file has not same number of columns in line2...
And, actually, matlab is F right: If I have a look at the resulting file, it has a first line of 9 elements, and a second line of 8287.
The third has 9, then 8287.
Etc.
I m really out of ideas, I can t see how it bugs here, I m defeinitely not familiar with awk, sed or paste, but this worked till now. I have no clue and I m in a huge hurry right now... (3 days to create the whole bunch of files but reaching this point and it doesnt do the jobbbbb)
How can I sort this out?
I mean, I don t mind if I have to rearrange the fileC, or if there s a nice instruction from fileA and fileB, but pleaaaaase, it would be so kind if one of you could give me a hand...
Many thanks,
iorga
(files are too big for editors)
First post here. I put all my hopes here, I m running out of time to get a file, and can t go further now, there s something wrong in my files.
I used a lot of times this instruction
paste M1_CGK025_K1K2K3T0T1T2T3.dat M1_CGK025_ITSIM.dat | awk 'BEGIN{OFS=" "};NF==9 {for (i=1; i<=NF; i++) printf ("%s ", $i);printf("\n") }' > M1_CG_K025_KTITSIM.dat
first file has 7 columns, 2nd file has 2 columns.
I wanted to paste both files, in a newfile (output file) of 9 columns
(50 lines in each of the files)
This works really well: the resulting file, M1_CG_K025_KTITSIM.dat (let s call it fileA) opened in matlab gives me a nice 50 * 9 matrix.
Now, I have another file, fileB. I can open it in matlab again with a simple load instruction, and it has 50 *8287 elements.
OK. So I want to repeat the same instruction, with paste and awk, to have a brand new fileC, whose ideal size loaded in matlab should be 50* (8287+9).
So i paste the last instruction:
paste fileA fileB | awk 'BEGIN{OFS=" "};NF==8296 {for (i=1; i<=NF; i++) printf ("%s ", $i);printf("\n") }' > fileC.dat
It seems to work, but actually matlab doesn t accept a LOAD on it, as it pretends the file has not same number of columns in line2...
And, actually, matlab is F right: If I have a look at the resulting file, it has a first line of 9 elements, and a second line of 8287.
The third has 9, then 8287.
Etc.
I m really out of ideas, I can t see how it bugs here, I m defeinitely not familiar with awk, sed or paste, but this worked till now. I have no clue and I m in a huge hurry right now... (3 days to create the whole bunch of files but reaching this point and it doesnt do the jobbbbb)
How can I sort this out?
I mean, I don t mind if I have to rearrange the fileC, or if there s a nice instruction from fileA and fileB, but pleaaaaase, it would be so kind if one of you could give me a hand...
Many thanks,
iorga
(files are too big for editors)