Dave wrote:

> This is better than anything I've dreamed up with sed or awk, and
> is really close, but it fails on this:

>  by nospam.mc.mpls.visi.com (8.11.6/8.11.6.2) with ESMTP id
3A4E07B03

I know you want to avoid perl, but this kind of problem is it's
sweet spot.  The following might be incrementally better (though the
expression to recognize a dotted quad is technically incorrect):

perl -ne '
    next unless /^by/; 
    @f=(split)[1..2]; 
    $_=pop @f; 
    s/^\D*//g; 
    s/\D*$//g; 
    push(@f,$_) if /^(\d{1,3}\.){3}(\d{1,3})$/; 
    print join(" ", @f)."\n";
'

I'm not fluent enough to translate it but I think awk has all the
required features to do so.

Tom McIntyre


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to