Remove new line characters


#1

How do i search and replace new line characters
for example i have a file like below
dog
cat
xyz

i want it to come as dog’,‘cat’,‘xyz’,’

I did select the regex and tried to do a search \n and replace with ‘,’ and the result was below
dog
','cat
','xyz
‘,’

how can i get it on one line without new line characters


#2

It looks like you’ve accidentally replaced \n with \n',' (or something similar).

Make sure the Use Regex button is active. Try again, with find as \n and replace as ','. I tested just now, and it works fine. E.g., the file with contents

dog
cat
wolf

Was transformed into

dog','cat','wolf','

If the issue persists, you may need to post the version of Atom you are using and other potentially relevant information (such as fully laid out steps to reproduce, starting in safe mode).


#3

The line ending in Windows looks different.
Best to use the regular expression search term: [\r\n|\n]