A IP Addresses Filtering Tool with Prefix and Suffix
with homebrew:
brew install kusshi94/tap/gipp
with go install
:
go install github.com/kusshi/gipp@latest
with files:
gipp [-e patterns ...] [file ...]
with stdin:
cat file | gipp [-e patterns ...]
gipp filters IP addresses that have the specified prefix. The prefix can be written in CIDR notation.
example:
gipp -e 192.168.1.0/24 input.txt
gipp filters IP addresses that have the specified suffix. The suffix can be written in CIDR notation-like format. You can specify the length of the suffix by writing a minus number after the slash.
example:
gipp -e 0.0.0.1/-8 input.txt
If you specify both prefix and suffix, gipp filters IP addresses that have the intersection of the prefix and suffix.
example:
gipp -e ::ef01:1ff:fe00:0/-64/104 input.txt