#! /usr/bin/gawk -f # Last edited on 2009-03-15 10:24:39 by stolfi # Adds 1 hour to the modtime in an ".sdf" listing as produced by # find-all-files-size-date. Reads stdin and writes stdout. //{ mo = substr($0,19,2); if (mo !~ /^[0-9][0-9]$/) { data_error(("bug 1 " hr)); } if (mo + 0 > 12) { data_error(("bug 2 " hr)); } if (mo + 0 == 0) { data_error(("bug 3 " hr)); } if ((mo == "11") || (mo == "12")) { hr = substr($0,25,2); if (hr !~ /^[0-9][0-9]$/) { data_error(("bug 4 " hr)); } if (hr + 0 > 24) { data_error(("bug 5 " hr)); } hr = sprintf("%02d", hr+1) print (substr($0,1,24) hr substr($0,27)); } else { print; } } function data_error(msg) { printf "%s:%d: %s\n", FILENAME, FNR, msg > "/dev/stderr" exit 1; }