I am writing a KSH shell script. It reads from a JSON file, which contains control characters like \n, \r and \t in place of actual newline characters or tabs (so the control characters are being read as actual strings). I am using jq to parse the stuff I want from this JSON file, and appending it to a text file. This text file also ends up having the strings like \n, \t instead of newline, tabs, etc. I want the text file to have actual meaning of these control characters.
For example, for the string "I\nam\na\ngood\nboy", I want my file to have:
I
am
a
good
boy
Any ideas on how to accomplish this in a shell script?
Note: I am writing in KSH, but answers in bash etc. would be acceptable.