regular expressions - math on backreferences
From: Chris Nolte (cgn3089_at_earthlink.net)
Date: 05/20/04
- Previous message: Yu Zhou: "perl module for rendering molecular interaction network graph??"
- Next in thread: Joe Smith: "Re: regular expressions - math on backreferences"
- Reply: Joe Smith: "Re: regular expressions - math on backreferences"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 20 May 2004 08:57:38 -0700
I want to write a Perl script to modify a bunch of my programming run
scripts, where each script will have a number of lines that need to be
incremented.
Here is what I have tried:
#!/usr/bin/perl -w
use strict;
foreach my $in (glob "run.cctm*") {
chomp($in);
open IN, "<$in" or die "can't open $in for input\n";
my $out = "$in.new";
open OUT, ">$out" or die "can't open $out for output\n";
while (<IN>) {
s,NEXTDAY\s*=\s*jul(\d+),NEXTDAY = jul$1+1,;
print OUT;
}
close IN;
close OUT;
}
original: set NEXTDAY = jul22
desired : set NEXTDAY = jul23
result : set NEXTDAY = jul22+1
Thanks for any help on how to do this.
Chris
- Previous message: Yu Zhou: "perl module for rendering molecular interaction network graph??"
- Next in thread: Joe Smith: "Re: regular expressions - math on backreferences"
- Reply: Joe Smith: "Re: regular expressions - math on backreferences"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|