0

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

bakoyaro
  • 2,550
  • 3
  • 36
  • 63
Sushanta
  • 1
  • 1
  • Not clear what you really need. You have two lines headed with "1", what about them in the "new file"? I can see only one... – Jean-Baptiste Yunès Jun 19 '15 at 14:56
  • Thanks for your time. Yeap, in the new file only one "1" (which is coming from file:1) and the second "1" (from file:2) changes to "1822" **which is the next number of file:1 last entiity 1821.** – Sushanta Jun 19 '15 at 17:31

1 Answers1

1

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
Magnus
  • 10,736
  • 5
  • 44
  • 57