Quote:
Originally Posted by Perceptor
sed s/[^0-9.]//g
|
The logic of this SED command is: "on each line of the file, delete the first instance of any character that is not either a numeral or a period."
I do not understand how that relates to OP's question.....!!!
Here is an incompletely de-bugged IP detector. In this case, it's just deleting all lines that don't contain an IP. It fails--e.g.-- on something like 137.56.23.4567
sed -r '/([0-9][0-9]?{2}\.){3}[0-9][0-9]?{2}/!d'
There are other threads here at LQ with examples of Regexes to find valid IPs.