Re: Conditional replace

2008-10-24 Thread Brian
Brian wrote: John W. Krahn wrote: Brian wrote: Partial success. The value is normally located starting at the 35th char into the line. I split the line so it was at the beginning of a new line and worked. Unfortunately the dates never changed. I will sleep on this and attack it again in

Re: Conditional replace

2008-10-23 Thread Brian
John W. Krahn wrote: Brian wrote: Partial success. The value is normally located starting at the 35th char into the line. I split the line so it was at the beginning of a new line and with> worked. Unfortunately the dates never changed. I will sleep on this and attack it again in the mornin

Re: Conditional replace

2008-10-22 Thread John W. Krahn
Brian wrote: Partial success. The value is normally located starting at the 35th char into the line. I split the line so it was at the beginning of a new line and with> worked. Unfortunately the dates never changed. I will sleep on this and attack it again in the morning. Based on the exam

Re: Conditional replace

2008-10-22 Thread John W. Krahn
Brian wrote: Brian wrote: John W. Krahn wrote: Brian wrote: #!/usr/bin/perl use warnings; use strict; @ARGV == 3 or die "usage: $0 \n"; my ( $search, $replace, $date ) = @ARGV; my ( $day, $mon, $year ) = ( localtime )[ 3, 4, 5 ]; my $today = sprintf '%02d/%02d/%04d', $day, $mon + 1, $

Re: Conditional replace

2008-10-22 Thread Brian
Brian wrote: Brian wrote: John W. Krahn wrote: Brian wrote: Hi Hello, #!/usr/bin/perl use warnings; use strict; @ARGV == 3 or die "usage: $0 \n"; my ( $search, $replace, $date ) = @ARGV; my ( $day, $mon, $year ) = ( localtime )[ 3, 4, 5 ]; my $today = sprintf '%02d/%02d/%04d', $day

Re: Conditional replace

2008-10-22 Thread Brian
Brian wrote: John W. Krahn wrote: Brian wrote: Hi Hello, #!/usr/bin/perl use warnings; use strict; @ARGV == 3 or die "usage: $0 \n"; my ( $search, $replace, $date ) = @ARGV; my ( $day, $mon, $year ) = ( localtime )[ 3, 4, 5 ]; my $today = sprintf '%02d/%02d/%04d', $day, $mon + 1, $y

Re: Conditional replace

2008-10-22 Thread Brian
John W. Krahn wrote: Brian wrote: Hi Hello, #!/usr/bin/perl use warnings; use strict; @ARGV == 3 or die "usage: $0 \n"; my ( $search, $replace, $date ) = @ARGV; my ( $day, $mon, $year ) = ( localtime )[ 3, 4, 5 ]; my $today = sprintf '%02d/%02d/%04d', $day, $mon + 1, $year + 1900; (

Re: Conditional replace

2008-10-22 Thread John W. Krahn
Brian wrote: Hi Hello, ARGV0 will = AB7Z001 ARGV1 will = AB7Z002 ARGV2 will = 01/01/1900 I would like to read a file, locate AB7Z001 (but not AB7Z0011, so a space at position 8 in string ) Upon location of value in argv0 replace it with argv1. Then, at the first instance of a date replace

Re: Conditional replace

2008-10-22 Thread brian54321uk
Rob Coops wrote: open (IN, "+; close IN; for ( my $i = 0; $i < scalar @file; $i++ ) { # loop trought the file line by line if ( $file =~ m/$ARGV0/g ) { # look for argument $ARGV0 $file =~ s/$ARGV0(\b.*)/$ARGV1$1/g; # replace argument $ARGV0 with $ARGV1 $file =~ s/(.*?)(\d{2}/\d{2}/\d{2}

Re: Conditional replace

2008-10-22 Thread Brian
From: Rob Coops <[EMAIL PROTECTED]> To: beginners@perl.org Sent: Wednesday, October 22, 2008 3:24:12 PM Subject: Re: Conditional replace On Wed, Oct 22, 2008 at 3:38 PM, Brian <[EMAIL PROTECTED]> wrote: > Hi > > ARGV0 will = AB7Z001 &

Re: Conditional replace

2008-10-22 Thread Rob Coops
On Wed, Oct 22, 2008 at 3:38 PM, Brian <[EMAIL PROTECTED]> wrote: > Hi > > ARGV0 will = AB7Z001 > ARGV1 will = AB7Z002 > ARGV2 will = 01/01/1900 > > I would like to read a file, locate AB7Z001 (but not AB7Z0011, so a space > at position 8 in string ) > Upon location of value in argv0 replace it w