substitution problems using perl
Nate
catenate at yahoo.com
Thu Nov 4 15:53:11 CST 1999
On the Jax.PM jacksonville-pm-list;
Nate <catenate at yahoo.com> wrote -
Hello again JaxPM!
I moved to Silicon Valley and got a job as a sys admin and Perl
scripter at a web hosting company.
I'm really busy rebooting the 10 or so NT webservers all the time ;)
and
just monitoring the
Linux box that has been up and running for 234 days straight :)
Anyways, I'm converting some zone files using perl (to move to new IP's
in a
new location),
and I've already made changes in the min TTL in the files, and now I'm
changing the serial
numbers on each file, but I can't get it to line up like it did before.
I'd like to stick two tabs at the beginning of the replacement text.
here's what it looks like before the change:
<snip>
@ IN SOA ns.comcity.com. webmaster.comcity.com. (
99102901
43200
7200
604800
3600 )
</snip>
then I run at the (windoze port of) bash command line:
c:\>perl -pi.bak -e 's/^\t\t9\d*$/99110420/e' COMCITY.zone
and I get this:
<snip>
@ IN SOA ns.comcity.com. webmaster.comcity.com. (
99110420
43200
7200
604800
3600 )
</snip>
Notice how I need the two tabs at the beggining?
I tried this:
c:\>perl -pi.bak -e 's/^\t\t9\d*$/\t\t99110420/e' COMCITY.zone
and this
c:\>perl -pi.bak -e 's/^(\t\t9\d*)$/"\t\t99110420"/e' COMCITY.zone
What's the right way? I'm sure it's easy, but I don't see the answer.
Please reply to me directly, I haven't subscribed this account to
JaxPM.
P.S. Here's an interesting one: what if I wanted to save the matched
number, and increment it by one?
Something like:
c:\>perl -pi.bak -e 's/^(\t\t9\d*)$/"$1++"/e' COMCITY.zone
=====
nate catenate at yahoo.com
my infosec favorites -> www.geocities.com/catenate/
There is no time BUT now.
__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com
The Jacksonville Perl Monger's Group is operated by -
Bill -Sneex- Jones ( sneex at usa.net ),
to whom send all praises, complaints, or comments...
More information about the Jacksonville-pm
mailing list