0

Hi everybody:

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

namefile_number.dat

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
do
    paste $i >> namefinal.dat
done

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

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

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:)

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by n2201
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.