8 fixlogfiledatetime - Set the target files modification time to their respective last log entry's timestamp
20 gz
) zcat
"$1" |
tail -n1;;
21 bz|bz2
) bzcat
"$1" |
tail -n1;;
22 xz
) xzcat
"$1" |
tail -n1;;
23 Z
) compress -d -c "$1" |
tail -n1;;
28 help_text
="Please give a perl(1) expression in DATETIME_PATTERN env variable to match and extract the datetime from log files. Example: 's/^[^>]+>((\S+\s+){3}).*/\$1/'"
32 dtstr
=$
(anytail
"$f" | perl
-ne "${DATETIME_PATTERN?$help_text} and print")
34 touch "$f" -t $
(date +%Y
%m
%d
%H
%M.
%S
-d "$dtstr")