NETCALC-SORT

NAME

netcalc-sort - sort a set of addresses

SYNOPSIS

netcalc sort [OPTIONS]

netcalc-sort [OPTIONS]

netcalcsort [OPTIONS]

nesort [OPTIONS]

DESCRIPTION

The netcalc sort widget processes one or more addresses, converts the addresses to a different address family, sorts the addresses, and displays the addresses using the format specificiers provided as command line arguments.

OPTIONS

-4, --ipv4

The input address uses the format for the IPv4 address family. This option can be combined with --ipv6, --eui48, and --eui64. Addresses of other address families will generate an error.

-6, --ipv6

The input address uses the format for the IPv6 address family. This option can be combined with --ipv4, --eui48, and --eui64. Addresses of other address families will generate an error.

-B net, --superblock=net

Restrict the address set to subnets of net.

-C af, --family af

Convert input addresses to address family af. Where af may be ipv4, ipv6, eui48, or eui64. The prefix ::ffff:0:0 will be used when converting from IPv4 addresses to IPv6 addresses. The prefix fe80:: will be used when converting from EUI-48 and EUI-64 addresses to IPv6 addresses.

-c, --continue

Continue processing addresses if syntax errors are detected.

-E, --eui64

The input address uses the format for the EUI-64 address family. This option can be combined with --ipv4, --ipv6, and --eui48. Addresses of other address families will generate an error.

-e, --eui48, --mac

The input address uses the format for MAC addresses or EUI-48 address family. This option can be combined with --ipv4, --ipv6, and --eui64. Addresses of other address families will generate an error.

-f file

Read addresses and comments from file. The default is to read addresses and comments from STDIN.

-h, --help

Print usage information and exit

-M

Display IPv6 addresses as IPv4-mapped IPv6 addresses.

-O

Report addresses which were processed out of order.

-p net, --prefix net

Similar to the -C option, but the address family is determined by the address net

When converting to an IPv6 address from an IPv4 address, the first 96 bits of net will be used as the prefix for the resulting IPv6 address and the CIDR will be set to the CIDR which is the larger of the source and net addresses.

When converting to an IPv6 address from an EUI-48 address, the source address is converted to a modified EUI-64 address and treated as an EUI-64 address.

When converting to an IPv6 address from an EUI-64 address, the first 64 bits of net will be used as the prefix for the resulting IPv6 address and the CIDR from the net address will be used as the CIDR of the resulting address.

-q, --quiet, --silent

Suppress warnings and excess messages

-S

Display IPv4 and IPv6 addresses without zero suppression. For example the address 203.0.113.0 will be displayed as 203.000.113.000 and the address 2001:db8::1 will be displayed as 2001:0db8:0000:0000:0000:0000:0000:0001.

-V, --version

Print version number and exit

-v, --verbose

Print additional information about the addresses and the supernet of all the provided addresses.

-Z

Display IPv6 addresses without zero compression. For example the address 2001:db8::1 will be displayed as 2001:db8:0:0:0:0:0:1.

--colon

Display EUI-48 and EUI-64 addresses in blocks of two digits with colons as delimiters. 00:16:3e:9b:54:54 is an example with an EUI-48 address and 00:16:3e:71:9c:52:f0:d9 is an example with an EUI-64 address. This is the default format for EUI-48 addresses.

--dash

Display EUI-48 and EUI-64 addresses in blocks of two digits with dashes as delimiters. 00-16-3e-9b-54-54 is an example with an EUI-48 address and 00-16-3e-71-9c-52-f0-d9 is an example with an EUI-64 address.

--colon

Display EUI-48 and EUI-64 addresses in blocks of four digits with dots as delimiters. 0016.3e9b.5454 is an example with an EUI-48 address and 0016.3e71.9c52.f0d9 is an example with an EUI-64 address. This is the default format for EUI-64 addresses.

FILE FORMAT

The widget expects the input file or STDIN to contain one address record per line. Each address record consists of an address and a comment separated by one or more white space characters (space or horizontal tab). White space at the beginning and end of the line is ignored.

The following shows the contents of an example file:

2001:db8:d::/56
203.0.113.0/24 documentation subnet per RFC5737
2001:db8::/32 documentation subnet per RFC3849
203.0.113.196/30
203.0.113.192/29
203.0.113.198/31 example point to point
2001:db8:d:a::/64
2001:db8:d::/48

EXAMPLE

The following shows the contents of the file with the records of addresses and comments:

cat example.txt
2001:db8:d::/56
203.0.113.0/24 documentation subnet per RFC5737
2001:db8::/32 documentation subnet per RFC3849
203.0.113.196/30
203.0.113.192/29
203.0.113.198/31 example point to point
2001:db8:d:a::/64
2001:db8:d::/48

The following shows the sort widget reading in a list of records from a file and displaying the sorted records:

netcalc sort -f example.txt
1: 203.0.113.0/24 documentation subnet per RFC5737
2: 203.0.113.192/29
3: 203.0.113.196/30
4: 203.0.113.198/31 example point to point
5: 2001:db8::/32 documentation subnet per RFC3849
6: 2001:db8:d::/48
7: 2001:db8:d::/56
8: 2001:db8:d:a::/64

SEE ALSO

netcalc(1), netcalc-match(1), netcalc-tree(1), netcalc-syntaxes(5)

AUTHOR

David M. Syzdek <david@syzdek.net>

ACKNOWLEDGEMENTS

Network Calculations Library is developed and maintained by David M. Syzdek <david@syzdek.net>.