I accidentally used the wrong-sided slash when trying to write the Newline (Line Feed) escape character, in C.

When trying to replace it in gedit:


I get this outcome:


Clearly gedit (version 3.18.3, running on my Ubuntu 16.04) is treating the New Line escape character as an excuse to actually spit out a new line.

Is this a known bug? It's an edge case, and I probably would have never even thought about it if I could write an escape character properly, but still - it made me curious as to what can be done to solve it.

I've tried parentheses, commas, one quotemark, two quotemarks.... no cigar.

The code itself is just an overly-tedious switch exercise from a book, LCTHW by Zed A. Shaw.


Gedit simply interprets the \n as newline character, which is correct and useful in my opinion, because it allows you to replace something with real line breaks.

To stop that and replace something with \n literally, you have to escape the backslash with another backslash and type \\n instead in the "Replace with" text field.

| improve this answer | |

Use \\n instead of \n in Replace with field

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.