I'm attempting to use GeekTool to display rendezviews information on my desktop (pertaining to itunes music sharing), how that people at my work have the ability to access my music...
I'm using a netstat command and filtering it with various commands to narrow down the output. The command, as I've got it now, is:
netstat | grep 3689 | tr -s " " "," | cut -f5 -d','
The result is something looking symiler to:
10.11.1.2.2885
10.11.1.3.2885
I'm trying to further refine this in a couple of manners. First is I want to strip the port number off the end. While I can use the cut command to split by the . and then choose the first 4 intervals, I cannot get them to print with the periods intact. (ie: I get 101112). I've been playing with using other commands, but nothing I've tried gives me the right result.
Anybody know how to this??? Keep in mind that the command needs to be in a single line.
Also keep in mind that this can end up being multiple occurences (each on it's own line).
I also wanted to find out if there is a way to add a prefix in front of the out put. I plan on cutting the lines so they all end up on the same line, but I would like to add a single prefix to the front, like:
Connected Systems: 10.11.3.2.2285
I also would like to replace the line returns with a comma and a space. I can figure out how to do it with just a comma or a space, but not both...
So basically the end result will look like:
Connected Sytems: 10.11.1.2, 10.11.1.3
Can anybody help???