Sample Header Ad - 728x90

Extracting IP from IP.port

1 vote
6 answers
6712 views
I've done a lot of digging but haven't found an answer to my problem. Currently, I have the following command: netstat | grep telnet | grep ESTABLISHED | awk 'NR==1{ print $5}' Which returns something like this: 192.168.15.73.64759 From this, I want to get just the IP without the port. So, 192.168.15.73 The system I'm doing this on runs an embedded Unix variant (QNX) and does not support -o as an option to grep. The system supports sed which is likely the best route, but I'm unfamiliar with that application. Can anyone tell me what I could add to get the output I'm looking for?
Asked by Trey (21 rep)
Aug 2, 2017, 05:57 PM
Last activity: Aug 24, 2022, 06:53 AM