hi hawk --   
 
In a message dated 3/23/2007 4:42:38 P.M. Eastern Standard Time,  
[EMAIL PROTECTED] writes:
 
> Hi,
> 
> Wondering if someone help with writing a perl  script to do this:
> 
> Before:
> ;BIND DUMP V8
>  $ORIGIN com.
> metropolitanbathtile    86400    IN      NS       ns1.ly.com.      ;Cl=2
>         86400    IN      NS       ns2.ly.com.      ;Cl=2
>         86400    IN      SOA     ns1.ly.com.  webmaster.friend.ly.net.  (
>                  2005011101 10800 3600 604800 86400 )     ;Cl=2
>         86400    IN      A        12.167.149.135  ;Cl=2
> $ORIGIN metropolitanbathtile.com.
>  *       86400    IN      A        12.167.149.135  ;Cl=2
> 
> After:
> 
> ;BIND DUMP  V8
> $ORIGIN com.
> metropolitanbathtile     86400   IN       NS      ns1.ly.net.      ;Cl=2
>         86400    IN      NS       ns2.ly.net.      ;Cl=2
>         86400    IN      SOA     ns1.ly.net.  webmaster.friend.ly.net.  (
>                  2005011102 10800 3600 604800 86400 )     ;Cl=2
>         86400    IN      A        12.167.149.135  ;Cl=2
> $ORIGIN metropolitanbathtile.com.
>  *       86400    IN      A        12.167.149.135  ;Cl=2
> 
> 
> --- replace ly.com to  ly.net
> --- if mail.ly.com exist, then replace with email.ly.net
>  --- increment serial: 2005011101 to 2005011102
> 
> 
> I know  I can do this easily with sed but don't know how to increment the
> serial  number.
> 
> Thx in advance


try something like this (assuming input is in file named  ``before''):   
 
C:[EMAIL PROTECTED]@friend.ly.net>perl  -pe
"s/(?<=ly\.)com/net/g;
s/mail\.ly\.com/email\.ly\.net/g;
my $sn  = qr/2005\d{6}/;  s/($sn)/ $1 + 1 /eg"  before  >  after

define $sn to be whatever matches unambiguously with your serial  number.   
be aware that  s/mail\.ly\.com/email\.ly\.net/g;  is a little  dangerous in 
that 
something like ``email.ly.com'' will become ``eemail.ly.net''.    maybe put a 
\b word boundary assertion in front of the pattern, 
i.e.,  s/ \b mail\.ly\.com / email\.ly\.net /xg;
 
hth -- bill walters   
 




************************************** AOL now offers free email to everyone. 
 Find out more about what's free from AOL at http://www.aol.com.
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to