An interactive sorting utility for text lines with various sorting options, similar to the Unix sort command but with real-time display as you type.
- Interactive sorting: See your data sorted in real-time as you type each line
- Multiple sorting modes:
- Alphabetical (default)
- Numeric (
-n) - Human-readable numbers (
-H) - handles 1K, 2M, etc. - Month-based (
-M) - sorts by month abbreviations (JAN, FEB, etc.)
- Sorting options:
- Case-insensitive sorting (
-f) - Reverse sorting (
-r) - Unique filtering (
-u) - Ignore non-printing characters (
-i) - Field separator support (
-t)
- Case-insensitive sorting (
pip install interactive-sortgit clone https://github.com/MightyHelper/interactive-sort.git
cd interactive-sort
pip install -e .After installation, you can run the tool using the interactive-sort command:
interactive-sort [OPTIONS]-f, --ignore-case Fold lower case to upper case characters
-i, --ignore-nonprinting Consider only printable characters
-M, --month-sort Compare (unknown) < 'JAN' < ... < 'DEC'
-H, --human-numeric-sort Compare human readable numbers (e.g., 2K 1G)
-n, --numeric-sort Compare according to string numerical value
-r, --reverse Reverse the result of comparisons
-u, --unique Output only the first of an equal sequence
-t, --field-separator Use FIELD as the field separator when finding an ordering key
interactive-sortType lines of text, and they will be sorted alphabetically in real-time. Press Ctrl+D (or Ctrl+Z then Enter on Windows) to finish.
interactive-sort -nSort lines numerically:
Input: 100, 20, 3
Output: 3, 20, 100
interactive-sort -HSort human-readable numbers:
Input: 1G, 500M, 2K
Output: 2K, 500M, 1G
interactive-sort -MSort by month abbreviations:
Input: MAR data, JAN data, FEB data
Output: JAN data, FEB data, MAR data
interactive-sort -frSort case-insensitively and in reverse order.
interactive-sort -t,Sort by the first field when using comma as separator:
Input: banana,fruit | apple,fruit | cherry,fruit
Output: apple,fruit | banana,fruit | cherry,fruit
You can also run the tool as a Python module:
python -m interactive_sort [OPTIONS]-
Clone the repository:
git clone https://github.com/MightyHelper/interactive-sort.git cd interactive-sort -
Install in development mode:
pip install -e . -
Install development dependencies:
pip install tox ruff pytest
Run tests using tox (tests multiple Python versions):
toxRun tests with pytest directly:
pytestFormat code:
ruff formatCheck formatting:
ruff format --checkLint code:
ruff checkMIT License. See LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.