I'm looking to manipulate the output of $tree --noreport$ in such a way that replaces the leading box-drawing characters and spaces on each line with a matching number of spaces. If I were to write the pattern for matching these characters, it would be ^\\(\u2500\\|\u2514\\|\u251C\\| \\)*\u2500. This string would be wrapped in $'...' because Unicode escape sequences are not recognized by sed. This pattern occurs on every line of the output of tree --noreport except for the first. Each character in each matching string needs to be replaced with a space.
Using sed to replace all occurrences at the beginning with a matching number of replacement strings
Melab
- 4.4k
- 10
- 42
- 59