#!/usr/bin/perl -w # -*- mode: perl; Encoding: sjis; coding: sjis -*- # Last updated: <2018/11/09 19:27:04 +0900> # # replace time stamp filter use strict; use warnings; my $patstart = "Last updated: <"; my $patend = ">"; my $chklines = 8; my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $year += 1900; $mon += 1; my $cnt = 0; while(<>) { chomp $_; if ($cnt <= $chklines && $_ =~ /(.+)$patstart.*$patend$/) { my $tmstr = sprintf("%04d/%02d/%02d %02d:%02d:%02d +0900", $year, $mon, $mday, $hour, $min, $sec); print "$1$patstart$tmstr$patend\n"; } else { print "$_\n"; } $cnt++; }