DESCRIPTION

usage: natsort [-h] [--version] [-p] [-f LOW HIGH] [-F LOW HIGH] [-e EXCLUDE]

  • [-r] [-t {digit,int,float,version,ver}] [--nosign] [--noexp] [--locale] [entries [entries ...]]

Performs a natural sort on entries given on the command-line. A natural sort sorts numerically then alphabetically, and will sort by numbers in the middle of an entry.

positional arguments:

entries

The entries to sort. Taken from stdin if nothing is given on the command line.

optional arguments:

-h, --help

show this help message and exit

--version

show program's version number and exit

-p, --paths

Interpret the input as file paths. This is not strictly necessary to sort all file paths, but in cases where there are OS-generated file paths like "Folder/" and "Folder (1)/", this option is needed to make the paths sorted in the order you expect ("Folder/" before "Folder (1)/").

-f LOW HIGH, --filter LOW HIGH

Used for keeping only the entries that have a number falling in the given range.

-F LOW HIGH, --reverse-filter LOW HIGH

Used for excluding the entries that have a number falling in the given range.

-e EXCLUDE, --exclude EXCLUDE

Used to exclude an entry that contains a specific number.

-r, --reverse

Returns in reversed order.

-t {digit,int,float,version,ver}, --number-type {digit,int,float,version,ver}, --number_type {digit,int,float,version,ver}

Choose the type of number to search for. "float" will search for floating-point numbers. "int" will only search for integers. "digit", "version", and "ver" are shortcuts for "int" with --nosign.

--nosign

Do not consider "+" or "-" as part of a number, i.e. do not take sign into consideration.

--noexp

Do not consider an exponential as part of a number, i.e. 1e4, would be considered as 1, "e", and 4, not as 10000. This only effects the --number-type=\,float\/.

--locale, -l

Causes natsort to use locale-aware sorting. On some systems, the underlying C library is broken, so if you get results that you do not expect please install PyICU and try again.

RELATED TO natsort…

The full documentation for natsort is maintained as a Texinfo manual. If the info and natsort programs are properly installed at your site, the command

  • info natsort

should give you access to the complete manual.