du | sort fails

Davin Pearson <[email protected]> Fri, 8 May 2009 22:01:58 -0700 (PDT)
Newsgroups gmane.comp.gnu.utils
Organization http://groups.google.com
Message-ID <ed970afa-a2de-4cf0-b1c9-9c9fa7bafe5a@s31g2000vbp.googlegroups.com>
I would like to sort the output of du using the sort command.  But
this fails:

du <dir> | sort

because du prints the sizes out like this:

123
12
1

rather than this: (prefixing with spaces)

123
 12
  1

Which would work.