I need to parse a text file which contains multiple lines of IP information but i want to extract the IP Address but exclude the subnet with CIDR using grep and a regex expression.
Sample text rows:
Removed host entry 10.43.160.72 @10.43.160.64/26-> esjc-test-sr90p
Removed host entry 10.26.232.157 @10.26.232.0/22-> esjc-test-sr90p
Desired output :
10.43.160.72
10.26.232.157
Currently im using :
grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}" test
But this also includes the subnet information i want to avoid .
Thanks!