Hi
This scripts sucks in a 109mb file and i'm trying to do a search and replace on
unxtime to the format from strftime. Which is working...
But I run this system call and it took allnight to run :(
So I killed it... Any other suggestions to reach my goal.....
#!/usr/bin/perl
use strict;
use POSIX 'strftime';
my $f = "/tmp/ip.txt";
open (FILE, "< /tmp/ip.txt") || die ("Open Failed: $!\n");
my @lines = <FILE>; # file into array
foreach (@lines) {
next if /^S/;
next if /^-/;
my @line = split(/\t/, $_);
my @time = split(/\n/, $line[0]);
foreach (@time) {
my $convtime = strftime('%Y-%m-%d %H:%M:%S', localtime($_));
system ("perl -pi -e 's/$_/$convtime/g' $f");
}
}
close FILE;
#
ip.txt before script:
Start header header
----- ----- -----
1074715516 rrr rrrr rrrr
1074715516 rrr rrrr rrrr
1074715516 rrr rrrr rrrr
1074715516 rrr rrrr rrrr
GOAL = ip.txt after script:
Start header header
----- ----- -----
2004-01-21 12:05:16 rrr rrrr rrrr
2004-01-21 12:05:16 rrr rrrr rrrr
2004-01-21 12:05:16 rrr rrrr rrrr
2004-01-21 12:05:16 rrr rrrr rrrr
thanks upfront,
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>