sorty

Sort lines per file size

Latest on Hackage:0.1.1

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

BSD-3-Clause licensed and maintained by Krzysztof Skrzetnicki

This simple tool sorts input filelines by first collumn suffixed by unit. Recognized units:

k = 1000
m = 1000 * k
g = 1000 * m
K = 1024
M = 1024 * K
G = 1024 * G

I needed this for output from 'du -h':

$ du -h -a
4,0K   ./sorty.cabal
20K   ./sorty.o
0   ./.#sorty.cabal
4,0K   ./#sorty.cabal#
4,0K   ./sorty.hs~
4,0K   ./sorty.hs
4,0K   ./sorty.hi
868K   ./sorty
912K   .

Filtered through sorty:

$ du -h -a | ./sorty

0   ./.#sorty.cabal
4,0K   ./sorty.cabal
4,0K   ./#sorty.cabal#
4,0K   ./sorty.hs~
4,0K   ./sorty.hs
4,0K   ./sorty.hi
20K   ./sorty.o
868K   ./sorty
912K   .