EnglishFrenchSpanish

OnWorks favicon

grepcidr - Online in the Cloud

Run grepcidr in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command grepcidr that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

PROGRAM:

NAME


grepcidr — Filter IPv4 and IPv6 addresses matching CIDR patterns

SYNOPSIS


grepcidr [OPTIONS] PATTERN [FILE...]

grepcidr [OPTIONS] [-e PATTERN | -f PATFILE] [FILE...]

DESCRIPTION


grepcidr can be used to filter a list of IP addresses against one or more Classless Inter-
Domain Routing (CIDR) specifications. As with grep, there are options to invert matching
and load patterns from a file. grepcidr is capable of efficiently processing large
numbers of IPs and networks.

OPTIONS


-V Show software version

-c Display count of the matching lines, instead of showing the lines

-i Inverse match, include lines without an IP, implies -v

-s Enforce strict alignment of CIDR mask; host portion must be all zero

-v Invert the sense of matching, output lines with IPs that don't match

-x Strict matching, only look at start of line

-e Specify individual IP or CIDR pattern(s) on command-line

-f Load individual IP or CIDR pattern(s) from file

USAGE NOTES


PATTERN specified on the command line may contain multiple patterns separated by
whitespace or commas. For long lists of network patterns, use -f to load a file where each
line contains one pattern (can be IPv4 or IPv6). Blank lines and comments starting with #
are ignored.

Each IPv4 pattern, whether on command line or loaded from a file, may be:

a.b.c.d/xy (CIDR format)
a.b.c.d-e.f.g.h (IP range)
a.b.c.d (Single IP)

And similarly for IPv6:

a:b:c::/xyz (CIDR format)
a:b:c:: (Single IP)

Dotted-decimal IPv4 format, or any legal IPv6 format is supported (see: man inet_pton).

IP addresses that appear anywhere on the input line will be compared and matched against
the patterns. To be recognized, an IP (field) must end with terminating text. An IPv4
field terminates upon anything other than alphanumeric or dot. An IPv6 field terminates
upon anything other than alphanumeric, dot, or colon. This is to prevent accidental
matching of ambiguous text such as host names containing reverse DNS.

Use the -x option to do a strict parse without searching the whole line, and grepcidr will
only look for the single IP at the start of the line.

EXAMPLES


grepcidr -f ournetworks blacklist > abuse.log

Find customers (CIDR ranges in file) that appear in blacklist

grepcidr 2001:db8::/32 log.1 log.2

Search for this IPv6 network inside two files

grepcidr 127.0.0.0/8 iplog

Searches for any localnet IP addresses inside the iplog file

grepcidr "192.168.0.1-192.168.10.13" iplog

Searches for IPs matching indicated range in the iplog file

script | grepcidr -vf whitelist > blacklist

Create a blacklist, with whitelisted networks removed (inverse)

grepcidr -f list1 list2

Cross-reference two lists, outputs IPs common to both lists

EXIT STATUS


As with grep: the exit status is 0 if matching IPs are found, and 1 if not found. If an
error occurred the exit status is 2.

Use grepcidr online using onworks.net services


Free Servers & Workstations

Download Windows & Linux apps

  • 1
    Psi
    Psi
    Psi is cross-platform powerful XMPP
    client designed for experienced users.
    There are builds available for MS
    Windows, GNU/Linux and macOS.. Audience:
    End Users...
    Download Psi
  • 2
    Blobby Volley 2
    Blobby Volley 2
    Official continuation of the famous
    Blobby Volley 1.x arcade game..
    Audience: End Users/Desktop. User
    interface: OpenGL, SDL. Programming
    Language: C++, Lua. C...
    Download Blobby Volley 2
  • 3
    SuiteCRM
    SuiteCRM
    SuiteCRM is the award-winning Customer
    Relationship Management (CRM)
    application brought to you by authors
    and maintainers, SalesAgility. It is the
    world�s mos...
    Download SuiteCRM
  • 4
    Poweradmin
    Poweradmin
    Poweradmin is a web-based DNS
    administration tool for PowerDNS server.
    The interface has full support for most
    of the features of PowerDNS. It has full
    support...
    Download Poweradmin
  • 5
    Gin Web Framework
    Gin Web Framework
    Gin is an incredibly fast web framework
    written in Golang that can perform up to
    40 times faster, thanks to its
    martini-like API and custom version of
    httprout...
    Download Gin Web Framework
  • 6
    CEREUS LINUX
    CEREUS LINUX
    CEREUS LINUX basado en MX LINUX con
    varios entornos de escritorios. This is
    an application that can also be fetched
    from
    https://sourceforge.net/projects/cereu...
    Download CEREUS LINUX
  • More »

Linux commands

  • 1
    aa-clickquery
    aa-clickquery
    aa-clickquery - program for querying
    click-apparmor DESCRIPTION: This program
    is used to query click-apparmor for
    information. USAGE: aa-clickquery
    --click-fra...
    Run aa-clickquery
  • 2
    aa-exec-click
    aa-exec-click
    aa-exec-click - program for executing
    click packages under confinement
    DESCRIPTION: This program is used to
    execute click package under AppArmor
    confinement. I...
    Run aa-exec-click
  • 3
    cpio
    cpio
    cpio - copy files to and from archives ...
    Run cpio
  • 4
    cpipe
    cpipe
    cpipe - copy stdin to stdout while
    counting bytes and reporting progress ...
    Run cpipe
  • 5
    FvwmSave
    FvwmSave
    FvwmSave - the Fvwm desktop-layout
    saving module ...
    Run FvwmSave
  • 6
    FvwmSave1
    FvwmSave1
    FvwmSave - the FVWM desktop-layout
    saving module ...
    Run FvwmSave1
  • More »

Ad