# Scans a Unix mail folder (separated by "From " lines) # For each message, if there is no "Date:" field in the # header, inserts a fake "Date: " line at the end of the # header, with the date given in the "From " line. # Stolfi 97-06-01 BEGIN { head = 0; hasdate = 0; recdate = "01 Jan 1900 00:00:01 +0000"; } /^From / { head = 1; hasdate = 0; recdate = ($3 ", " $5 " " $4 " " $7 " " $6 " -0200"); print $0; next; } /^Date:/ { if (head == 1) hasdate = 1; print $0; next; } /^ *$/ { if (head == 1) { head = 0; if (! (hasdate == 1)) print ("Date: " recdate); } print $0; next; } /^/ { print $0; } END { }