From "Warp Bot"
To: "Warp Info"
Sent: Thursday, March 28, 2002 12:33 PM
Subject: Warp Records Letter - March 28th - live news
Hello and welcome to a Warp Records news letter.
We have lots and lots of live action coming up.
From MAILER-DAEMON
From: "Warp Bot"
To: "Warp Info"
Date: 21 Mar 2002 12:33
Subject: Warp Records Letter - March 28th - live news
Hello and welcome to a Warp Records news letter.
We have lots and lots of live action coming up.
cat YOUR_FILE |sed -e 's/^From/From MAILER-DAEMON\nFrom:/' > NEW_FILEI think you missed a : after the first From in your example, if this is true just remove the last : from the regex.
cat NEW_FILE | sed -e 's/^Sent:/Date:/' > NEWER_FILE
cat YOUR_FILE |sed -e 's/^From/From MAILER-DAEMON\nFrom:/' > NEW_FILE
From MAILER-DAEMONn From: "John B"
From "John B"
From MAILER-DAEMON
From: "John B"
To convert a non-standard mailbox file into a standard mailbox file you can use:
formail -ds <old_mailbox >>new_mailbox
cat NEW_FILE | perl -pe 's/^Sent:.*([A-Z]..)[a-z]* (\d+), (\d+) (\d+):(\d+) ([AP]M)/sprintf "Date: %0.2d %s %04d %0.2d:%0.2d %0.2d%0.2d", $2, $1, $3, $4 % 12 + 12 * ($6 eq "PM"), $5, -5, 0/e' > NEWER_FILE
You are not logged in, either login or create an account to post comments
posted by yesno at 10:55 AM on November 2, 2009