Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Oct 2002 20:16:07 -0300 (ART)
From:      Fernando Gleiser <fgleiser@cactus.fi.uba.ar>
To:        Brendan McAlpine <bmcalpine@macconnect.com>
Cc:        questions@freebsd.org
Subject:   Re: Script Help
Message-ID:  <20021008200627.E3949-100000@cactus.fi.uba.ar>
In-Reply-To: <0E990523-DAC9-11D6-AEC1-000393012742@macconnect.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 8 Oct 2002, Brendan McAlpine wrote:

> Hey all,
>
> I am poring over mail logs and trying to pull out all the email
> addresses contained in the log.  Does anyone have any idea how I could
> do this with a shell script?

Untested, and asuming sendmail log format:

#!/usr/bin/perl -w

while (<>) {
	if (m/=<([^@>]+@[^>]+)/) {
		print "$1 \n";
	}
}

Translation: for every line, if line matches a '=', followed by a '<',
followed by (one or more of anything but a '@' or a '>' followed by a '@'
and then one or more of anything but a '>')

print the part that matches between the parens



			Fer
>
> Thanks
>
> Brendan
>
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message
>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021008200627.E3949-100000>