From owner-freebsd-questions@FreeBSD.ORG Wed Aug 24 12:58:43 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 0B08316A420 for ; Wed, 24 Aug 2005 12:58:43 +0000 (GMT) (envelope-from antennex@swbell.net) Received: from ylpvm12.prodigy.net (ylpvm12-ext.prodigy.net [207.115.57.43]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3D46343D70 for ; Wed, 24 Aug 2005 12:58:35 +0000 (GMT) (envelope-from antennex@swbell.net) Received: from ylpvm01.prodigy.net (ylpvm01-int.prodigy.net [207.115.5.207]) by ylpvm12.prodigy.net (8.12.10 outbound/8.12.10) with ESMTP id j7OCwVQM020639 for ; Wed, 24 Aug 2005 08:58:32 -0400 X-ORBL: [65.68.247.73] DomainKey-Signature: a=rsa-sha1; s=sbc01; d=swbell.net; c=nofws; q=dns; h=message-id:reply-to:from:to:cc:references:subject:date: mime-version:content-type:content-transfer-encoding:x-priority: x-msmail-priority:x-mailer:x-mimeole; b=IO3oo4PNjPWpVeyz5llE2jkpGEZqp8Yyr3e4mjd64QyPYRM7lDH35lreEufHIHwUd yzEEiXK3XZQX/2+UT8OCw== Received: from SAGEAME (adsl-65-68-247-73.dsl.crchtx.swbell.net [65.68.247.73]) by ylpvm01.prodigy.net (8.13.4 dk-milter linux/8.13.4) with SMTP id j7OCwSOE004757; Wed, 24 Aug 2005 08:58:29 -0400 Message-ID: <042701c5a8ab$88debd60$0200000a@SAGEAME> From: "antenneX" To: "antenneX" , "Giorgos Keramidas" References: <040a01c5a847$7a0353f0$0200000a@SAGEAME><20050824011632.GA6103@gothmog.gr> <041801c5a84c$1a196560$0200000a@SAGEAME> Date: Wed, 24 Aug 2005 07:58:32 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1506 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 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 Reply-To: antenneX List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Aug 2005 12:58:43 -0000 ----- Original Message ----- From: "antenneX" To: "Giorgos Keramidas" Cc: Sent: Tuesday, August 23, 2005 8:35 PM Subject: Re: Script help using "cut" > ----- Original Message ----- > From: "Giorgos Keramidas" > To: "antenneX" > Cc: > Sent: Tuesday, August 23, 2005 8:16 PM > Subject: Re: Script help using "cut" > > > > 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 > > > Just woke up this morning and realized I needed to chop off more -- everything except the domain. So, instead of spammer@badguy.com I need the result badguy.com How could the above awk line be expanded to chop off the username@ portion as well? Sorry, must have been really tired.