From: pk on
Ciccio wrote:

> Ok,
>
> $ eval $(netstat -an | /usr/xpg4/bin/awk -F '\.| +' -v OFS=. '/
> TIME_WAIT/{
> print "LOCALIP="$1,$2,$3,$4
> print "LOCALPORT="$5
> print "REMOTEIP="$6,$7,$8,$9
> print "REMOTEPORT="$10
> }')
>
> no errors now, but no output either...

That is expected. Check the values of the variables, rather.
From: Seebs on
On 2009-11-03, Ciccio <lserena(a)gmail.com> wrote:
> 10.159.244.250.80 10.159.244.250.49198 49152 0 49152 0

> I need to obtain these 4 variables ($LOCALIP $LOCALPORT $REMOTEIP
> $REMOTEPORT) to pass to tcpdrop.

Okay.

How about:

> Here is what I came up with - and it works, but is there a better/
> faster/neater way of doing it?

D='[0-9]*'
IP="$D\.$D\.$D\.$D"
EXPR="\\($IP\\)\.\\($D\\) *\\($IP\\)\.\\($D\\)"

netstat -an | sed -ne "s/.* $EXPR.*TIME_WAIT/tcpdrop \1 \3 \2 \4/p"

You can add a | sh to the end to execute the results, but run it like
this first to be sure it's giving you what you want.

You could type the expression in literally, too, but I liked this better.

-s
--
Copyright 2009, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
From: Kaz Kylheku on
On 2009-11-03, Ciccio <lserena(a)gmail.com> wrote:
> Hi List,
>
> Given the output below,
>
> $ netstat -an | grep TIME_WAIT
> 10.159.244.250.80 10.159.244.250.49198 49152 0 49152 0
> TIME_WAIT

Who in their right separates port numbers from the IP address with a dot???

Which OS has this retarded netstat program?
From: Alan Curry on
In article <20091103132125.598(a)gmail.com>,
Kaz Kylheku <kkylheku(a)gmail.com> wrote:
>On 2009-11-03, Ciccio <lserena(a)gmail.com> wrote:
>> Hi List,
>>
>> Given the output below,
>>
>> $ netstat -an | grep TIME_WAIT
>> 10.159.244.250.80 10.159.244.250.49198 49152 0 49152 0
>> TIME_WAIT
>
>Who in their right separates port numbers from the IP address with a dot???

tcpdump prints them that way, yet still manages to be widely used.

--
Alan Curry
From: Dave on
Ciccio wrote:

> #!/bin/bash

I would have thought
#!/bin/sh

would have been an improvement, and write it in a portable way, without the
GNUisms.

dave
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4
Prev: [tcsh] Screen's ^] inserting junk
Next: Parsing GC Log File