5 Nov
2001
5 Nov
'01
2:25 p.m.
I think the following code is better, because it allows domain names to start with digits when handling email that has subcribe abc@21cn.com in the Subject line. address=`$formail -k -xSubject: | $sed -n -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' \ -e '/^[ ]*[^ a-z]/ q' \ -e 's/^[^@]*add[ ]*'\ '[^ ]*[ ]\([^ ]*[-a-z0-9_][@!][a-z0-9][^ ]*\).*/\1/p' \ -e 's/^[^@]*address[ ]*'\ '[^ ]*[ ]\([^ ]*[-a-z0-9_][@!][a-z0-9][^ ]*\).*/\1/p' \ -e 's/^[^@]*sub[ ]*'\ '[^ ]*[ ]\([^ ]*[-a-z0-9_][@!][a-z0-9][^ ]*\).*/\1/p' \ -e 's/^[^@]*subscribe[ ]*'\ '[^ ]*[ ]\([^ ]*[-a-z0-9_][@!][a-z0-9][^ ]*\).*/\1/p' ` THe only difference is I added 0-9 in the sed check after the @ symbol. mark