hadoop-tools
hadoop-tools copied to clipboard
Using boxes makes output hard to grep
Using boxes for du hh output makes it hard to grep the output due to the right padding.
Here's a contrived shell session.
$ hh du /some/directory
1G /some/directory/ABC/
1G /some/directory/A/
1G /some/directory/B/
1G /some/directory/C/
$ hh du /some/directory | egrep '/[A-Z]/$'
$ hh du /some/directory | hexdump -C
00000000 31 47 20 2f 73 6f 6d 65 2f 64 69 72 65 63 74 6f |1G /some/directo|
00000010 72 79 2f 43 2f 20 20 0a |ry/C/ .|
$ hh du /some/directory | egrep '/[A-Z]/ *$'
1G /some/directory/A/
1G /some/directory/B/
1G /some/directory/C/
$
@thsutton maybe it's enough for us to just trim the whitespace of the end of each line?
Yeah, should be. Something like
s/printBox/unlines . fmap (dropWhileEnd (`elem` " \t")) . lines . render/