- Code: Select all
ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
However, I think the following in awk is easier to read (mainly because it is not sed), and also does not stumble on files that end in ':',
the output is also sorted in alphabetical order
- Code: Select all
du | awk '{print $2}' | sort | awk 'BEGIN{FS="/"}NF>1{printf"|"; for(i=1;i<2*(NF-1);i++){printf "-"};print $NF}'
example:
- Code: Select all
|-JCopy
|-MFCC
|---outputs
|-gmm_train
|---outputs
|---mfc1
Does anyone else have any nifty implementations?
