add 250 single column files to create one file
Hi every one
I have the following problem I have 250 single column files, I would like to generate a single file with 250 columns. Each file has 18265 rows. I tried with sed, paste, and awk. I have the impression that awk is powerful enough to do the job, however I'm learnig about it. Also paste should do the job, but it simply doesn't. Can you help me |
Hi.
Welcome to LQ! What did you already tried? It looks like `paste' does exactly what you want: Code:
$ cat f1 |
Quote:
Daniel B. Martin |
That's right
Paste should do it I tried ls *.txt > lista.rtf paste `less lista.rft` > complete_file.txt Also I tried "manually" paste file1.txt file2.txt file3.txt > newfile.txt All I got is a two column file where data in files 2 and 3 are mixed up in the same column What I would like to have is Stn ALALAY YOTALA ... 250 files lat -19.668 -17.258 lon -65.324 -66.147 1961 1.6000 9.8540 . . . 18265 rows Thanks for your help |
Please use the [CODE] .. [/CODE] tags around your code and data to preserve formatting.
Your command Code:
$ paste file1.txt file2.txt file3.txt > newfile.txt BTW you can supply all 250 files using glob pattern: Code:
$ paste file*.txt > newfile.txt |
All right,
I'm pretty new to this things, I have Code:
$ more AGUIRRE.txt Whenever I try Code:
$ paste AGUIRRE.txt ALAMOS.txt YACUIBA.txt > newfile.txt Code:
$ more newfile.txt |
I works correctly here (using cut and paste data from your post).
My only GUESS is that the actual files have some extra characters that somehow confuse paste. If you can attach the actual files, we can dig deeper. |
3 Attachment(s)
All right pixellany,
Attached you will find the three (of 250) files |
bingo!! Those files are in DOS text format---you can use "dos2unix" to convert them.
(I found this by using hexdump (found the DOS 0d+0a sequence (carriage return + newline)---there is probably an easier way) |
You nailed it! (I think) I was looking at the same thing, I'm converting my files, I'll yell if something arises
Thanks a lot |
Quote:
Code:
InFile1='/home/daniel/Desktop/LQfiles/dbm408inp1.txt' Code:
InFiles='/home/daniel/Desktop/LQfiles/dbm408inp*.txt' |
All times are GMT -5. The time now is 06:28 AM. |