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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.