hadoop-tools icon indicating copy to clipboard operation
hadoop-tools copied to clipboard

Using boxes makes output hard to grep

Open thsutton opened this issue 8 years ago • 2 comments

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 avatar Nov 23 '16 02:11 thsutton

@thsutton maybe it's enough for us to just trim the whitespace of the end of each line?

jacobstanley avatar Nov 23 '16 04:11 jacobstanley

Yeah, should be. Something like

s/printBox/unlines . fmap (dropWhileEnd (`elem` " \t")) . lines . render/

thsutton avatar Nov 23 '16 04:11 thsutton