I am in need of a solution, preferably sed, that can match on an IP octet that contains any number combination and remove the line. For example:
My file:
192.168.100.12
192.168.200.12
10.10.20.10
10.10.30.20
I need to remove the line that contains any IP found on the 10.10.20.x subnet and remove it. So, if the file contains 10.10.20.10 , 20.11, 20.12, etc... They all get removed. I also need an inline replacement.
What I have tried:
sed -i '/10\.10\.20\.\([0-9]\{1,3\}\)/d' file
and this:
sed -i '/10.\.10\.20\.*\([0-9]\{1,3\}\)*/d' file
And neither one works. The command completes with no errors, but the lines are still in the file. I am also open to other solutions such as awk.