From owner-freebsd-questions Tue Oct 8 16:18:29 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0762337B401 for ; Tue, 8 Oct 2002 16:18:28 -0700 (PDT) Received: from cactus.fi.uba.ar (cactus.fi.uba.ar [157.92.49.108]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0357B43E42 for ; Tue, 8 Oct 2002 16:18:26 -0700 (PDT) (envelope-from fgleiser@cactus.fi.uba.ar) Received: from cactus.fi.uba.ar (cactus.fi.uba.ar [157.92.49.108]) by cactus.fi.uba.ar (8.12.3/8.12.3) with ESMTP id g98NG7AO018929; Tue, 8 Oct 2002 20:16:07 -0300 (ART) (envelope-from fgleiser@cactus.fi.uba.ar) Date: Tue, 8 Oct 2002 20:16:07 -0300 (ART) From: Fernando Gleiser To: Brendan McAlpine Cc: questions@freebsd.org Subject: Re: Script Help In-Reply-To: <0E990523-DAC9-11D6-AEC1-000393012742@macconnect.com> Message-ID: <20021008200627.E3949-100000@cactus.fi.uba.ar> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Status: No, hits=-3.4 required=5.0 tests=IN_REP_TO version=2.31 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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