Link to home
Start Free TrialLog in
Avatar of john lambert
john lambert

asked on

Regex to filter only IP's?

How to filter this IP only?

89.35.24.74     7 msmta9.newcombo.net  
89.35.24.83     8 msmta18.newcombo.net
12.35.24.83     8 msjohn123
100.200.30.20  rapasins

Output:

89.35.24.7
89.35.24.83
12.35.24.83
100.200.30.20
Avatar of Rgonzo1971
Rgonzo1971

Hi,

pls try
\b([0-9]{1,3}\.){3}[0-9]{1,3}\b

Open in new window

Regards
you don't need an ereg if you just want the first column

in shell scripting you can do this

while read ip junk ; do echo $ip ; done <INPUT_FILE >OUTPUT_FILE

what is tyour environment ? unix shell ? windows shell ? perl ? asp ?
ASKER CERTIFIED SOLUTION
Avatar of Dan Craciun
Dan Craciun
Flag of Romania image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of john lambert

ASKER

thank you!!!ur the best!!