[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:
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
text.txt
Quote:
eregerg344jjkl234.234.234.1:80ddjrroos0344mduiiweddw121.045.001.2:65534ooooogteg |
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