Article 6EQGG [SOLVED] How to extract ip and port from a text

[SOLVED] How to extract ip and port from a text

by
pedroa
from LinuxQuestions.org on (#6EQGG)
Hello everyone , i have a doubt , i want to extract ips and ports from this text :

text.txt
Quote:
eregerg344jjkl234.234.234.1:80ddjrroos0344mduiiweddw121.045.001.2:65534ooooogteg
on normal circumstances i can get the ips using :

Code:grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' text.txthow can i complete that grep sentence to add also the ports in those ips ?

Output expected :
234.234.234.1:80
121.045.001.2:65534

Thank you
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments