Date: Thu, 21 Aug 2008 08:52:18 -0400 From: Steve Bertrand <steve@ibctech.ca> To: freebsd-questions@freebsd.org Subject: Re: sed/awk, instead of Perl Message-ID: <48AD6502.1040407@ibctech.ca> In-Reply-To: <48AD63B7.8090107@ibctech.ca> References: <48AD63B7.8090107@ibctech.ca>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48AD6502.1040407>
