Computing.Net > Forums > Unix > SED Question

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

SED Question

Reply to Message Icon

Name: Scott
Date: October 27, 2003 at 08:32:11 Pacific
OS: AIX 5.2
CPU/Ram: ?
Comment:

We just upgraded our test server to AIX 5.2 from 4.3.3 this past weekend. Now, one of our scripts is messing up that uses output from the lsof command. I have narrowed it down to one line in the script, but I don't sed well enough to understand what it is doing. Can someone please help me decipher what this line is doing?

PORT=`echo "$remainder" | sed 's%\(.*\) \*:\([0-9]*\) \(.*\)%\2%'`

$remainder is the output from the lsof command.

Thanks,
Scott



Sponsored Link
Ads by Google

Response Number 1
Name: Anagram
Date: November 4, 2003 at 13:45:49 Pacific
Reply:

I tried this out just to see, and best I can tell you is that it finds all the open files representing processes listening for foreign (not localhost) network connections to anonymous hosts on port numbers that have not been named, replacing those lines with just the portnumbers. Or in otherwords it is reporting all those TCP/IP port numbers that the machine is actively listening on, yet that port number appears not to have a servicename.

e.g., these lines...

xdm 212 0 6u inet 0x3d47a900 0t0 TCP *:4816 (LISTEN)

portmap 300 0 5u inet 0x16a0c100 0t0 TCP *:111 (LISTEN)


will be replaced with...

4816

111


but these lines...

named 22068 13 23u inet 0xd7c79400 0t0 TCP localhost:domain (LISTEN)

inetd 24543 0 5u inet 0x99ac3400 0t0 TCP *:telnet (LISTEN)


will be ignored. Perhaps somekind of intrusion detection of somesort. I hope this is helpful to you.


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: SED Question

sed question www.computing.net/answers/unix/sed-question-/5518.html

Sed question www.computing.net/answers/unix/sed-question/6826.html

general sed question www.computing.net/answers/unix/general-sed-question/3935.html