I have a legacy system that only accepts Windows \r\n and I want to edit a file in VS Code that has just \n to have \r\n.
I'm trying to use a Regex replace:

But this puts literal \r in instead of the whitespace char.
I've tried putting a newline in the replacement using SHIFT+ENTER:

But this just puts in \n.
How do I change the line feed chars used and save the file in VS Code?
There's the text "LF" in the bottom bar on the right, click on it and select "CRLF". Or press Ctrl+Shift+P and enter Change End of Line Sequence.
No idea why your approach doesn't work. Nor does \x0D or \15 get recognized. I'd call it a bug.
For multiple files, on Linux, I'd do it outside of the editor, e.g., with
find somedir -name '*.someext' -exec perl -pi -e 's/\n/\r\n/' {} +
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With