in reply to search and replace last line
#!/usr/local/bin/perl my @fileslurp = (); my $datefld = ""; my $testdate = "200208"; my $newline = "Not the old date\n"; my $thisfile = "/var/tmp/junk.log"; open (FILE,"$thisfile"); @fileslurp = <FILE>; close FILE; ($datefld) = split(/ /,@fileslurp[$#fileslurp]); @fileslurp[$#fileslurp] = $newline if ($datefld eq "$testdate") ; foreach $x (@fileslurp) { print $x; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: search and replace last line
by Anonymous Monk on Aug 07, 2002 at 15:56 UTC | |
by derby (Abbot) on Aug 07, 2002 at 17:32 UTC |