We help IT Professionals succeed at work.
Get Started

need to find and replace numbers within a document and increment by 1

631 Views
Last Modified: 2012-05-12
I have a text file which is a deposition transcript ( a simple TXT file ) laid out as follows.

00000
     1 jkfdkjdfjkdfdjfk
     2 sdfkjsdfdjkfdjkfdfkj
     3 dfkldfkldfkldfkldfkldfkl
     4 kldfkdfkdfkdlfkdfldfkl
     5  kfdlkdflkdfklfdklfd
     6 dfjkdfjkfdjdkffjkdfdjk
     7 dfkldfkldfkldfkldfkldfkl
00001
     1 jkfdkjdfjkdfdjfk
     2 sdfkjsdfdjkfdjkfdfkj
     3 dfkldfkldfkldfkldfkldfkl
     4 kldfkdfkdfkdlfkdfldfkl
     5  kfdlkdflkdfklfdklfd
     6 dfjkdfjkfdjdkffjkdfdjk
     7 dfkldfkldfkldfkldfkldfkl
00002
     1 jkfdkjdfjkdfdjfk
     2 sdfkjsdfdjkfdjkfdfkj
     3 dfkldfkldfkldfkldfkldfkl
     4 kldfkdfkdfkdlfkdfldfkl
     5  kfdlkdflkdfklfdklfd
     6 dfjkdfjkfdjdkffjkdfdjk
     7 dfkldfkldfkldfkldfkldfkl

The five digit numbers represent page numbers, the single digits represent line numbers. Each page actually has 25 lines per page and the page numbers actually go up to about 500.

My problem is , whoever created this file started with page 00000 and not page 00001 , so now the program that reads this file is incorrect by one page.

I want to know if anyone has any idea how I could easily fix the page numbering in this txt file.  I was thinking of some kind of advanced find and replace and increment by 1 ?

Any thoughts are appreciated
Comment
Watch Question
Test your restores, not your backups...
CERTIFIED EXPERT
Expert of the Year 2019
Distinguished Expert 2020
Commented:
This problem has been solved!
Unlock 1 Answer and 7 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE