Hi everybody:

I have a problem :?:, I would like to paste different files which has this pattern name:


like this:

namefile_1.dat namefile_2.dat ....

And I have tried to use paste command, for create a name_final.dat. But such I have done:

paste namefile_*.dat > name_final.dat

It works but I would like that paste command do it in order :confused:. Then I have done:

for i in namefile*.dat
    paste $i >> namefinal.dat

And paste it but all in one column, like this:


My question is. Is there any solution for from different files where each file is named like namefile_number.dat paste all in one but each time that paste act it do it in columns. Like this:

namefile_1.dat namefile_2.dat ...... namefile_number.dat


Oh I forget it, there are some numbers that do not exist.

Thanks in advance:)

Have you tried ls and then pipe the out put to sed and replace all spaces with single space?