From the following list, I want to remove all IP addresses that have the same value as subnets.
Code:
cat input.out
192.168.1.208
192.168.1.208/32
192.168.1.213/32
192.168.1.214/32
192.168.1.253/32
192.168.1.254
192.168.1.254/28
192.168.1.245/32
192.168.1.180
192.168.1.181
For that I am using "w" flag in grep to match the whole word.
That however, is also matching addresses with subnet.
Code:
cat input.out | grep -Evw "192.168.1.208|192.168.1.254"
192.168.1.213/32
192.168.1.214/32
192.168.1.253/32
192.168.1.245/32
192.168.1.180
192.168.1.181
Question:
How can i filter out IP addresses that have the same value as subnets and keep the ones with subnet?
This is what I am trying to get.
Code:
192.168.1.208/32
192.168.1.213/32
192.168.1.214/32
192.168.1.253/32
192.168.1.254/28
192.168.1.245/32
192.168.1.180
192.168.1.181