From owner-freebsd-questions@FreeBSD.ORG Wed Aug 24 01:16:42 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org 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 156CE16A41F for ; Wed, 24 Aug 2005 01:16:42 +0000 (GMT) (envelope-from keramida@ceid.upatras.gr) Received: from kane.otenet.gr (kane.otenet.gr [195.170.0.95]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5456E43D45 for ; Wed, 24 Aug 2005 01:16:40 +0000 (GMT) (envelope-from keramida@ceid.upatras.gr) Received: from gothmog.gr (patr530-b127.otenet.gr [212.205.244.135]) by kane.otenet.gr (8.13.4/8.13.4/Debian-1) with ESMTP id j7O1GbG8011426; Wed, 24 Aug 2005 04:16:38 +0300 Received: from gothmog.gr (gothmog [127.0.0.1]) by gothmog.gr (8.13.4/8.13.4) with ESMTP id j7O1GYok006131; Wed, 24 Aug 2005 04:16:34 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from giorgos@localhost) by gothmog.gr (8.13.4/8.13.4/Submit) id j7O1GXl5006130; Wed, 24 Aug 2005 04:16:33 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Date: Wed, 24 Aug 2005 04:16:32 +0300 From: Giorgos Keramidas To: antenneX Message-ID: <20050824011632.GA6103@gothmog.gr> References: <040a01c5a847$7a0353f0$0200000a@SAGEAME> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <040a01c5a847$7a0353f0$0200000a@SAGEAME> Cc: freebsd-questions@freebsd.org Subject: Re: Script help using "cut" X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Aug 2005 01:16:42 -0000 On 2005-08-23 20:02, antenneX wrote: > Been trying to complete a script that I can use to grep spam emails > from the maillog, then trim it to just the plain email address. Trying > to use "cut" in the script but it's not doing what I want yet. > > Here is what the earlier lines have the lines down to so far: > " (envelope-from spammer@badguy.com)" -- no quotes > ...and I want this "clean" trimmed result after trim using "cut" or > anything else that works to trim/cut: > > spammer@badguy.com <--- no underlines of course > > That's a TAB space at beginning of the line. > > The "envelope" lines are in a tmp file in colum format (one line below > the other). > (envelope-from spammer@badguy.com) > (envelope-from spammer2@badguy2.com) > (envelope-from spammer3@badguy3.com) > > All ideas appreciated.... Does it have to be cut(1)? $ awk '{print $2}' tmpfile | sed -e 's/)[[:space:]]*$//' | sort | uniq