[RndTbl] Month name to number, and sendmail

Sean A. Walberg sean at ertw.com
Wed Feb 11 08:23:11 CST 2004

Last night a couple of questions came up (both from Steve, I think).  The 
first is for a filter that converts a month name to a month number from 
within an ls listing.  Locale is probably the most correct approach, but 
BFI works great too:

ls -l | perl -p -e '@m=qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov 
Dec/; for ($i=0; $i<@m; $i++){ s/\b$m[$i]\b/$i+1/e}'

And, how to generate an email from the command line with custom 
from/reply-to headers, use sendmail -t and write down the headers 

/usr/lib/sendmail -t <<MAIL
From: "Angry Taxpayer" <testing at taxpayer.com>
To: "Sean" <sean at ertw.com>
Reply-To: "Paul Martin" <paulm at canadianrulingparty.gc.ca>
Subject: Tax cuts

Dear Sir,

I pay too much in tax



Sean A. Walberg <sean at ertw.com>                    http://www.ertw.com 

More information about the Roundtable mailing list