Hi! I worked on Sam's idea and, instead of sed, I made up a little gawk
script to normalize the Date: field of messages. It works like a charm!
Note that:
1) It doesn't check for duplicate Date: fields, but it does add one if
the header comes to an end without one;
2) It renames the old Date: field to Client-Date:;
3) It adds "(server time)" at the end of the new Date: field
4) I couldn't extract an RFC-822-compliant string from strftime (that's
why the servertz variable). Anyone can tip me on how to do that?
-----------------------------------------------------------------------
#!/usr/bin/gawk -f
BEGIN {
inheader = 1;
datenotparsed = 0;
servertz = "-0300";
}
function printdate() {
print "Date: " strftime("%a, %e %h %Y %T ") servertz " (server
time)";
}
{
if ($0 == "")
{
inheader = 0;
if (datenotparsed)
printdate();
}
if (inheader)
{
if (substr($0, 1, 6) == "Date: ")
{
print "Client-" $0;
printdate();
datenotparsed = 0;
}
else
print $0;
}
else
print $0;
}
-----------------------------------------------------------------------
--
___THE___ One man alone cannot fight the future. USE LINUX!
\ \ / / _______________________________________________
\ V / |Juan Carlos Castro y Castro |
\ / |[EMAIL PROTECTED] |
/ \ |Linuxeiro, alvinegro, X-Phile e Carioca Folgado|
/ ^ \ |Diretor de Informática e Eventos Sobrenaturais |
/ / \ \ |da E-RACE CORPORATION |
~~~ ~~~ -----------------------------------------------
RACER