"tree" command output with "pure" (7-bit) ASCII output
I'm not sure about this but I think all you need is
tree | sed 's/├/\+/g; s/─/-/g; s/└/\\/g'
For example:
$ tree
.
├── file0
└── foo
├── bar
│ └── file2
└── file1
2 directories, 3 files
$ tree | sed 's/├/\+/g; s/─/-/g; s/└/\\/g'
.
+-- file0
\-- foo
+-- bar
│ \-- file2
\-- file1
2 directories, 3 files
Alternatively, you can use the --charset
option:
$ tree --charset=ascii
.
|-- file0
`-- foo
|-- bar
| `-- file2
`-- file1
2 directories, 3 files
What about tree --charset unicode
?
|-- boot_print
| |-- config-2.6.32-5-amd64
| |-- grub
| | |-- 915resolution.mod
| | |-- acpi.mod
| | |-- affs.mod
| | |-- afs_be.mod
| | |-- afs.mod
| | |-- aout.mod
| | |-- ata.mod
| | |-- ata_pthru.mod
| | |-- at_keyboard.mod
| | |-- befs_be.mod
| | |-- befs.mod
| | |-- biosdisk.mod
| | |-- bitmap.mod
| | |-- bitmap_scale.mod
| | |-- blocklist.mod
| | |-- boot.img
I tried the following to change locale. It also outputs ascii code draw lines same as --charset=ascii.
> LANG=C tree