To this end, I've written a Python program I call 'sorttop'; it continually reads stdin, sorts the first column according to magic (i.e., human numbers like from "du -h" work as expected), and shows the top items read so far. Example usage: du -hx / | python sorttop.py
Update, Feb 20, 2012: Revised the script to work for more terminals; fixes a traceback on the line 'bol = curses.tparm(ti_hpa, 0)' when TERM=screen.
Files currently attached to this page:
sorttop.py | 3.3kB |
Entry first conceived on 19 February 2012, 16:54 UTC, last modified on 21 February 2012, 2:56 UTC
Website Copyright © 2004-2024 Jeff Epler