how can i merge multiple files in linux?

85 views Asked by At

I have 30 different length files, each of which start with 1 and ends by around 2000. I can join them by using "cat" options in unix but I want to join those files sequentially. Here is the picture of files:

File:1

1 T= 295. E= -.72913162E+03 .. ..

1821 T= 314. E= -.72917614E+03

File:2

1 T= 326. E= -.72917628E+03 .. ..

1834 T= 318. E= -.72917464E+03.

I want like this,

NEW FILE

1 T= 295. E= -.72913162E+03 .. ..

1821 T= 314. E= -.72917614E+03

1822 T= 326. E= -.72917628E+03 .. ..

3655 T= 318. E= -.72917464E+03

1

There are 1 answers

1
Magnus On

Not sure I understand all your constraints, but how about just stripping off the numbers and renumbering from scratch, eg

cat * | sed 's/ *[0-9]* //' | nl