open my $in, '<', 'infile.txt' or die "Bummer: $!"; open my $out, '>', 'outfile.txt' or die "What: $!"; while(my $line = <$in>){ if(my ($epoch) = $line =~ /^#\+(\d+)\s*$/){ my $human_readable = `date -d \@$epoch`; # or: # my $human_readable = scalar localtime $epoch; print $out $human_readable; } else{ print $out $line; } }
In reply to Re^5: Epoch time conversion script
by lidden
in thread Epoch time conversion script
by hedkandi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |