grepcidr 1.2 - Filter IP addresses matching IPv4 CIDR specification
Copyright (C) 2004  Jem E. Berkes <jberkes@pc-tools.net>
	http://www.pc-tools.net/unix/grepcidr/
	http://www.sysdesign.ca/


PURPOSE
-------
grepcidr can be used as a stream filter when you need to compare a list of
IP addresses against one or more Classless Inter-Domain Routing (CIDR)
mask specifications. Think of grepcidr as a CIDR-aware grep; instead of
using 'grep 1.2.3.4' you can use 'grepcidr -e 1.2.3.4/30', for example. 
Multiple specifications, of arbitrary mask lengths, can be specified 
both on the command line or loaded from a file.

grepcidr has many uses in network software, including: mail filtering and
processing, network security, log analysis, and many custom applications.


COMPILING & INSTALLING
----------------------
Edit Makefile to customize the build. Then,
make
make install


COMMAND USAGE
-------------
Usage: grepcidr [-V] [-c] [-v] [-e PATTERN | -f FILE]

-V	Show software version
-c	Display count of the matching lines, instead of showing the lines
-v	Invert the sense of matching, to select non-matching IP addresses
-e	Specify pattern(s) on command-line
-f	Obtain CIDR pattern(s) from file

The syntax of the CIDR patterns is the same whether specified on the
command line or within a file: aaa.bbb.ccc.ddd/xx where each octet of the
IP is between 0 and 255, and the optional /xx mask is 1 to 32 bits.  
Separate multiple specifications by newlines, whitespace, or commas. When
loading from a file, any comment lines starting with # are skipped.

Examples:
grepcidr -e "192.168.0.1/18, 10.0.0.0/8, 1.2.3.4"
cat entire.list | grepcidr -v -f whitelist > trimmed.list
