0

I have a file exported from a mysql database which include \n (literally) for end-of-line. This file is composed of one line only because the end-of-line symbol is not interpreted

my file is like this \n there is another line \n and I would like "\n" to be interpreted

How can I replace \nwith a actual new line?

There are a lot of answer to this question with notepad++ but I am on Linux. I tried this solution with emacs but C-q C-j did not create a new line in my buffer.

ppr
  • 685
  • 7
  • 24

1 Answers1

0
(replace-string "\\n" "\n")

If you are looking for an interactive keyboard sequence, try M-% \ n C-j RET ! (but realize that Stack Overflow is for programming questions).

If you are on some godforsaken platform where C-j doesn't emit a newline, try C-q C-j or the octal sequence C-q 0 1 2 (recall that LF is octal 012).

tripleee
  • 175,061
  • 34
  • 275
  • 318
  • Actually, the question you linked to already covers all these bases. I'm guessing you missed the answer which reveals how to input an octal character code. – tripleee Oct 26 '22 at 11:08