Advertisement
Guest User

redate.pl

a guest
Mar 15th, 2015
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.49 KB | None | 0 0
  1. foreach my $p (@ARGV) {
  2.     my $date = time;
  3.     open(F, "<", "$p/data/System/$p.txt") || die "Could not open $p for read";
  4.     my @lines;
  5.     while (my $l = <F>) {
  6.         chomp($l);
  7.         if ( $l =~ /^%META:(TOPICINFO|FILEATTACHMENT){(.*)}%$/ ) {
  8.             $l =~ s/date=\"\d+\"/date="$date"/;
  9.         }
  10.         push(@lines, $l);
  11.     }
  12.     close(F);
  13.     open(F, ">", "$p/data/System/$p.txt") || die "Could not open $p for write";
  14.     print F join("\n", @lines);
  15.     close(F);
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement