
Murphy Mac sent us a link to a handy find/sed command that simulates the DOS tree command that you might be missing on your Mac or Linux box.
find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
You can see the result in the image above. Like most things I've seen sed do, it does quite a bit in a single line of code and is completely impossible to read. Sure it's just a couple of substitutions, but like a jack in the box, it remains a surprise every time I run it.





































Maybe, you should know that there is already a "tree" command on linux which does already exactly what you did. It can even have colours.
Reply to this comment
That's still a killer one-liner. Is it wrong that such things make me squeal like an 8 year old getting a new toy?
Reply to this comment
tree for Mac OS X is available via: http://rudix.org
Another tool would be durep.
Reply to this comment
It is a pretty impressive one liner, but a more full-featured port of the Linux tree command is available via MacPorts:
http://www.macports.org/
port install tree
Reply to this comment