### Batch replace: Grab characters from elsewhere in the source?

Posted:

**Mon Jan 31, 2005 5:32 pm**I have a batch configuration I run from time to time to edit code.

In the code, I have these 2 lines that appear like this:

SR:SC20050

PR:3120

...and this:

SR:SC20050

PR:3120

...and this:

SR:SC20050

PR:3120

...and so on. The last 3 digits of the "PR" line is a counter, basically. The numbers are unique, are always 3 digits, but not necessarily in numerical order.

I need to change the letters "BOX" to the 3-digits from the end of the "PR" line, so I end up with this instead:

SR:SC20050

PR:3120

SR:SC20050

PR:3120

SR:SC20050

PR:3120

Can AF&R do this? And how?

In the code, I have these 2 lines that appear like this:

SR:SC20050

**BOX**PR:3120

**001**...and this:

SR:SC20050

**BOX**PR:3120

**002**...and this:

SR:SC20050

**BOX**PR:3120

**003**...and so on. The last 3 digits of the "PR" line is a counter, basically. The numbers are unique, are always 3 digits, but not necessarily in numerical order.

I need to change the letters "BOX" to the 3-digits from the end of the "PR" line, so I end up with this instead:

SR:SC20050

**001**PR:3120

**001**SR:SC20050

**002**PR:3120

**002**SR:SC20050

**003**PR:3120

**003**Can AF&R do this? And how?