{"id":16410308,"url":"https://github.com/ctrlcctrlv/humnumsort","last_synced_at":"2025-06-17T23:02:29.096Z","repository":{"id":65146479,"uuid":"539180846","full_name":"ctrlcctrlv/humnumsort","owner":"ctrlcctrlv","description":"Human numeric sorting program — does what `sort -h` is supposed to do!","archived":false,"fork":false,"pushed_at":"2023-05-21T23:49:30.000Z","size":85,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-16T13:08:18.938Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ctrlcctrlv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-20T20:31:10.000Z","updated_at":"2023-12-22T23:04:54.000Z","dependencies_parsed_at":"2024-10-11T06:23:53.495Z","dependency_job_id":"d915eaf1-0b2e-45fa-a66a-9593011706cb","html_url":"https://github.com/ctrlcctrlv/humnumsort","commit_stats":{"total_commits":15,"total_committers":1,"mean_commits":15.0,"dds":0.0,"last_synced_commit":"cf5f99d3e75aba9d56726ef1077b445536765d8f"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/ctrlcctrlv/humnumsort","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrlcctrlv%2Fhumnumsort","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrlcctrlv%2Fhumnumsort/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrlcctrlv%2Fhumnumsort/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrlcctrlv%2Fhumnumsort/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ctrlcctrlv","download_url":"https://codeload.github.com/ctrlcctrlv/humnumsort/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrlcctrlv%2Fhumnumsort/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260453717,"owners_count":23011572,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T06:23:51.928Z","updated_at":"2025-06-17T23:02:24.077Z","avatar_url":"https://github.com/ctrlcctrlv.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `hns` — *H*uman *N*umeric *S*ort v0.3.0 (⏫︎2023-05-21)\n\n* © 2022–2023 Fredrick R. Brennan and `hns` Authors\n    * Apache 2.0 licensed, see LICENSE.  \n* [**`man` page**](http://copypaste.wtf/humnumsort/doc/hns.1.html)\n\n## Packages\n\n* [`hns_0.3.0_amd64.deb` (for Debian, Ubuntu, Pop! OS, etc.)](https://github.com/ctrlcctrlv/humnumsort/releases/download/v0.3.0/hns_0.3.0_amd64.deb)\n* [`hns-0.3.0-1.x86_64.rpm` (for Fedora, CentOS _n_, Red Hat Linux, etc.](https://github.com/ctrlcctrlv/humnumsort/releases/download/v0.3.0/hns-0.3.0-1.x86_64.rpm)\n* [`humnumsort.PKGBUILD` (for Arch Linux)](dist/aur/PKGBUILD)\n\n### Or if you have a Rust toolchain, install via Rust's package manager, `cargo`:\n\n* `cargo install hns`\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://docs.rs/humnum\"\u003e\n    \u003cimg src=\"https://docs.rs/humnum/badge.svg\" alt=\"Documentation\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://crates.io/crates/hns\"\u003e\n    \u003cimg src=\"https://img.shields.io/crates/v/hns.svg\" alt=\"Version\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/ctrlcctrlv/humnumsort/blob/main/LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/crates/l/hns.svg\" alt=\"License\"\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n## Commercial\n\n**Has this ever happened to you?**\n\n```bash\n$ seq 1 30 | awk '{printf \"data_%s.txt\\n\", $1}' | sort -h \u003e important_filenames.txt\n$ sort -h \u003c important_filenames.txt\n```\n\n```\ndata_10.txt\ndata_11.txt\ndata_12.txt\ndata_13.txt\ndata_14.txt\ndata_15.txt\ndata_16.txt\ndata_17.txt\ndata_18.txt\ndata_19.txt\ndata_1.txt\ndata_20.txt\ndata_21.txt\ndata_22.txt\ndata_23.txt\ndata_24.txt\ndata_25.txt\ndata_26.txt\ndata_27.txt\ndata_28.txt\ndata_29.txt\ndata_2.txt\ndata_30.txt\ndata_3.txt\ndata_4.txt\ndata_5.txt\ndata_6.txt\ndata_7.txt\ndata_8.txt\ndata_9.txt\n```\n\nOh no! You forgot that the `-h` flag of the GNU coreutils `sort` package doesn't actually do what it claims to, and can't be fixed for various historical reasons (stay with me now don't fall asleep)!\n\n```\n       -h, --human-numeric-sort\n              compare human readable numbers (e.g., 2K 1G)\n```\n\nIf only there was a better way!\n\nHi, FREDDY MAYS here with another FUR-tastic invention. All your numbers, sorted just for you!\n\n```bash\n$ mv important_filenames.txt tests/data/README_example.txt\n$ hns \u003c tests/data/README_example.shuf.txt\n```\n```\ndata_1.txt\ndata_2.txt\ndata_3.txt\ndata_4.txt\ndata_5.txt\ndata_6.txt\ndata_7.txt\ndata_8.txt\ndata_9.txt\ndata_10.txt\ndata_11.txt\ndata_12.txt\ndata_13.txt\ndata_14.txt\ndata_15.txt\ndata_16.txt\ndata_17.txt\ndata_18.txt\ndata_19.txt\ndata_20.txt\ndata_21.txt\ndata_22.txt\ndata_23.txt\ndata_24.txt\ndata_25.txt\ndata_26.txt\ndata_27.txt\ndata_28.txt\ndata_29.txt\ndata_30.txt\n```\n\nWow!\n\nBut if you `git pull` in the next Unix epoch, you'll also get my super duper negative number-understanding version!\n\n```bash\n$ seq -10 10 | awk '{printf \"data_%s.txt\\n\", $1}' | sort -h \u003e tests/data/README_example2.shuf.txt\n```\n\nBefore your numbers were sad and drab…\n\n```\ndata_0.txt\ndata_-10.txt\ndata_10.txt\ndata_-1.txt\ndata_1.txt\ndata_-2.txt\ndata_2.txt\ndata_-3.txt\ndata_3.txt\ndata_-4.txt\ndata_4.txt\ndata_-5.txt\ndata_5.txt\ndata_-6.txt\ndata_6.txt\ndata_-7.txt\ndata_7.txt\ndata_-8.txt\ndata_8.txt\ndata_-9.txt\ndata_9.txt\n```\n\nBut now they can be radically sequential! (Woah!)\n\n```bash\n$ hns \u003c tests/data/README_example2.shuf.txt\n```\n```\ndata_-10.txt\ndata_-9.txt\ndata_-8.txt\ndata_-7.txt\ndata_-6.txt\ndata_-5.txt\ndata_-4.txt\ndata_-3.txt\ndata_-2.txt\ndata_-1.txt\ndata_0.txt\ndata_1.txt\ndata_2.txt\ndata_3.txt\ndata_4.txt\ndata_5.txt\ndata_6.txt\ndata_7.txt\ndata_8.txt\ndata_9.txt\ndata_10.txt\n```\n\nSo simple to use! No command line options! Just standard in and standard out, one size fits all! (Really, Freddy?) (Yes!)\n\nAnd it's not only for short files, oh no no no! It's written in Rust so you know it can handle even the largest data overflows, such as an entire randomly sorted Class A network!\n\n```bash\n$ time RUST_LOG=INFO target/release/hns \u003c /tmp/0.0.0.0／8.shuf.txt \u003e /dev/null\n```\n```ini\n[2022-09-20T14:58:00Z INFO  hns] Reading done; got 16777216 lines in 348513µs\n[2022-09-20T14:58:28Z INFO  hns] Sorting done; sorted 16777216 lines in 27122184µs\n[2022-09-20T14:58:32Z INFO  hns] Writing done; wrote in 4370570µs\n```\n```\nreal    0m31.855s\nuser    0m30.306s\nsys     0m1.548s\n```\n\nSixteen million lines with four comparison points each sorted in under thirty seconds! And that's a Freddy Mays guarantee.\n\n## Changelog\n\n### v0.3.0 (2023-05-21)\n\n- +`-C` flag (case insensitive sort)\n\n### v0.2.0 (2023-05-11)\n\n- 30x faster\n\n### v0.1.1 (2022-09-22)\n\n- hexadecimal mode\n\n### v0.1.0 (2022-09-21)\n\n- initial release\n\n## Benchmarking data\n\n* See [`humnumsort-test-data` repository](https://github.com/ctrlcctrlv/humnumsort-test-data/).\n\n    You may want to clone it as:\n\n    ```bash\n    $ git clone https://github.com/ctrlcctrlv/humnumsort-test-data/ tests/data/expensive\n    ```\n\n## TODO\n\n* Zero-padding via another binary?\n\n## License\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an _“as is” basis,\nwithout warranties or conditions of any kind_, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fctrlcctrlv%2Fhumnumsort","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fctrlcctrlv%2Fhumnumsort","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fctrlcctrlv%2Fhumnumsort/lists"}