From owner-freebsd-questions@FreeBSD.ORG Thu Aug 21 12:50:49 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E0A81065672 for ; Thu, 21 Aug 2008 12:50:49 +0000 (UTC) (envelope-from steve@ibctech.ca) Received: from ibctech.ca (v6.ibctech.ca [IPv6:2607:f118::b6]) by mx1.freebsd.org (Postfix) with SMTP id 360668FC17 for ; Thu, 21 Aug 2008 12:50:49 +0000 (UTC) (envelope-from steve@ibctech.ca) Received: (qmail 13404 invoked by uid 89); 21 Aug 2008 12:58:18 -0000 Received: from unknown (HELO ?IPv6:2607:f118::5?) (steve@ibctech.ca@2607:f118::5) by 2607:f118::b6 with ESMTPA; 21 Aug 2008 12:58:18 -0000 Message-ID: <48AD6502.1040407@ibctech.ca> Date: Thu, 21 Aug 2008 08:52:18 -0400 From: Steve Bertrand User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <48AD63B7.8090107@ibctech.ca> In-Reply-To: <48AD63B7.8090107@ibctech.ca> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: sed/awk, instead of Perl 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: Thu, 21 Aug 2008 12:50:49 -0000 Steve Bertrand wrote: > To put it plainly, can anyone, if it's possible, provide a single line > sed/awk pipeline that can: To answer my own post, I found in some past notes something I drummed up quite a while ago that I can most certainly modify to suit my needs: # Cat the tcpdump output file # confirm that the source IP is NOT the mail server, and print the source IP/port # separate the IP/port entries # eliminate only the port and print IP # clean out the spaces in the IP cat tcpdump.txt | awk '{if ($3 != "192.168.100.204.25") print $3}' | \ awk '{FS = "."} {print $1,".",$2,".",$3,"."$4}' | sed s/" "//g Steve