hns < input > output
hns < <(…) > output
| hns > output …
Fredrick Brennan <copypaste@kittens.ph>, humnumsort
Project Authors
A "human numeric" sorting program — does what sort -h
is supposed to do!
(That is to say, it does what you likely already thought or may've assumed GNU/BSD sort -h
does.)
-h, --help
Print help information
-V, --version
Print version information
find . | hns
Numerically sort the names of the files in the current directory.
hns < <(dig peeweeharms.hk)
Numerically sort the IP addresses in the output of dig
.
#!/bin/bash
# ①
seq 0 1000
|
xargs -I{} bash -c "echo {{}} > {}"
# ②
seq 0 1000
|
# ③
awk '{printf "mv %s topsecret_%s.json\n", $0, $0}'
|
parallel
# ④
paste <(seq 0 1000) <(hns < <(echo topsecret_[[:digit:]]*.json))
|
awk '{mv %s topsecret_%04d.json\n", $2, $1}' | parallel
Use as part of a pipeline to fix accidentally unzeropadded numbers 😄
0..=1000
hns
!