tr command – how to replace the string “\n” with an actual newline (\n) [closed]

Here’s how to do it with sed:

sed 's/\\n/\n/g'

Example usage:

To replace all occurrences of \n in a file in-place:

sed -i 's/\\n/\n/g' input_filename

To replace all occurrences of \n through a pipe, and save into another file

cat file1 file2 file3 file4 | sed 's/\\n/\n/g' > output_file

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)