Hi,
I have two files. The first one contains the list of all INDIA IPs (Subnets ) and the second one has list of IPs all countries.
I just want to remove all the INDIA IPs from the second file.
Please help me. Thanks in advance.
How to remove all india IPs from a text file ?
Re: How to remove all india IPs from a text file ?
First sort them
then filter out equal entries
P.S. This actually works only for IPv4 addresses, but the concept is applicable to any IP type
Code: Select all
sort -u -t. -k1,1n -k2,2n -k3,3n -k4,4n <in.zone >in.zone.sorted
sort -u -t. -k1,1n -k2,2n -k3,3n -k4,4n <all.zone >all.zone.sorted
Code: Select all
sdiff -ls in.zone.sorted all.zone.sorted
Root is evil: Do not use root (sudo) to run any of the commands specified in my posts unless explicitly indicated. Please, provide the necessary amount of context to understand your problem/question.