Hi I have the following script that sucks in a file and converts unix timestamp to human readable..
The Goal is to do a search and replace of unix time to the format i need. But I'm just trying to get it to print in the format i need first... I cant get localtime to print in "mm-dd-yyyy hh:mm:ss" , I keep getting it like so "Sun Dec 28 03:35:19 2003" #!/usr/bin/perl use strict; # #my $timestring = localtime(); open (FILE, "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 ($sec,$min,$hour,$mday,$mon,$year) = localtime($_); # need to print like mm-dd-yyyy hh:mm:ss my $timestring = localtime($_); # but prints like "Sun Dec 28 03:35:19 2003" print "$timestring\n"; } } close FILE; # more ip.txt: Start header header ----- ----- ----- 1072611319 rrr rrrr rrrr 1072611319 rrr rrrr rrrr 1072611319 rrr rrrr rrrr 1072611319 rrr rrrr rrrr Thanks Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>