0

I have a command which gives a big text and I want to replace all the \ns with actual new line char. Tried <my command> | tr '\\n' '\n' but its replacing ns as well along with \ns

echo $aa
Kanil\nSigtia

echo $aa | tr "\\\n" '\n'
Ka
il

Sigtia

I want

Kanil
Sigtia

or

Kanil

Sigtia

Dont mind either, its just for some logs, to make them readable

Kapil
  • 149
  • 1
  • 13
  • 1
    Can you try to use `echo -e`, this should honor escape characters. – tresf Aug 08 '23 at 04:43
  • 1
    yeah `echo -e` does the trick but I will have to wrap my command. Found another way ````my command | sed 's/\\n/\ /g' ``` – Kapil Aug 08 '23 at 06:18

0 Answers0