using afr to increment values

General discussions about Advanced Find and Replace
Post Reply
benhab
Posts: 2
Joined: Wed Mar 30, 2005 8:37 am

using afr to increment values

Post by benhab »

Hi, I just found your product and so far in my testing is does everything that i'd like it to, except for one thing. I'm currently working with some dns zone files which have a format of

@ IN SOA dns-1.example.com. webadmin.example.com. (
18 ; Serial number
900 ; Refresh
600 ; Retry
86400 ; Expire
3600 ) ; Minimum TTL
NS dns-1.example.com.
NS dns-2.example.com.
A nnn.nnn.nnn.nnn
MX 10 mail
mail A nn.nn.nnn.n
www A nnn.nnn.nnn.nnn

What i'm having a hard time wraping my head around is how to take the "Serial Number" (in this case 18, but could be different for each file) and increment it's value by 1. (ie 18 -> 19). Is there a way that AFR can do this or am I back to writing code? If it does than you just got yourselves another customer!!!

Thanks in advance,
benhab

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre »

Hi,

It's not possible to do now with AFR, but I know how to quickly
implement it (we already have a pretty framework for it). We will develop it this week. I will send you a message
then.
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre »

Hi,

Ok, we implemented the feature.

Please download the latest version of the program:
http://www.abacre.com/download/afrexe.zip

This is only updated EXE file. You need to extract executable file from
zip archive into folder where the program is installed. So you will
replace old executable file by this new one.

Start the program. In main menu Action - Options - Batch replace:
check ON modifier E (which means evaluate text in <>).

Then go to Batch replace tab of the main window
and put into
Search for:
(\w+) ; Serial number

Replace with:
<$1+1>; Serial number

That's all. I verified and it perfectly works.

Note that if you are sure that the line starts with serial number then
you may use ^ before the regular expression. ^ means start of the
line. So in this case you should put ^(\w+) ; Serial number into
Search for field.

Tell me does it work now?
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

benhab
Posts: 2
Joined: Wed Mar 30, 2005 8:37 am

awesome!!! couple of tweeks works great!

Post by benhab »

Thank Roman so very much, can't tell you how much time this saved me. We'll definetly be purchasing the product. And heartily recommending it to all who ask.

FYI... I used the follow regexs to get it to work.

Search For:
(.*\d*.*);.*Serial number

Replace with:
<$1+1>; Serial number\r\n

Thanks again,
Ben Habing
Infrastructure Architect
Genesys Networks Inc.

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre »

BTW, just a quick note: in official version of the program we will use
<%= =%>
for evaluating the expressions instead of < > described here.
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

Post Reply