@rem = '--*-Perl-*-- @echo off if "%OS%" == "Windows_NT" goto WinNT perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9 goto endofperl :WinNT perl -x -S %0 %* if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl if %errorlevel% == 9009 echo You do not have Perl in your PATH. if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul goto endofperl @rem '; #!/usr/bin/perl -w #line 15 # -*- 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++; } __END__ :endofperl