티스토리 뷰

공부

[sh] replace ${varName//$'\n'/\\n}

승가비 2023. 7. 22. 11:29
728x90

https://superuser.com/questions/955935/how-can-i-replace-a-newline-with-its-escape-sequence

 

How can I replace a newline with its escape sequence?

Using sed to make text that contains certain characters suitable for use in string literals is straightforward: sed "s/\\\\/\\\\\\\\/g" sed "s/\\\"/\\\\\\\"/g" But how can I do something similar ...

superuser.com

 

728x90
댓글