Ok, so I am currently trying to remove a string from the result of a readable text file there just IP addresses and hostnames. I'm attempting to get rid of the hostnames and just have the IP addresses so that I can then scan the result which should be the left over IP addresses.
with open('test.txt','r') as f:
for line in f:
subst = ""
test_str = line
result = re.sub("[a-zA-Z]", subst, test_str, 0)
if result:
print(result)
With this, I can remove the letters from the host names in the file which gives me these.
89008..9..
29014..9..
121.25.30.237
143.55.50.238
162.34.50.149
89008..9..
89008..9..
19002..9..
The left over numbers above and below the IP's are whats remaining of the host names. Is there any way I can get rid of the remaining number only leaving the IP's? aka just 121.25.30.237, 143.55.50.238, and 162.34.50.149 I've been using regex101 to test random things but I can't seem to find what I need.