Sample colored text (this is produced from ls):\e[0m\e[01;34m.cache\e[0m/\e[01;34minferno\e[0m/\e[01;34m.JUNK\e[0m/\e[01;34m.nano\e[0m/\e[01;34mpoo\e[0m/\e[01;34mPrograms\e[0m/\e[01;34mrestore\e[0m/\e[01;34m.ssh\e[0m/\e[34;42mWorkspace\e[0m/a.sh.bash_history\e[01;32m.bash_profile\e[0m*.bashrcgg dd.txtSed command that won't work:sed -r 's/^((\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK])*[^\.])/ \1/'I'm attempting to do this by echoing a variable containing the text and piping it into sed, like so: echo $text | sed -r 's/^((\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK])*[^\.])/ \1/'I just want any line that does not start with a period to have a single space prepended before it. I've spent hours on this, please help.
Use sed to add a space before every line starting with a period, compatible with terminal colors
linux;text processing;sed;colors