If you have a file or a string that you want to replace every new line with a comma follow the below steps,
- Open the file in Sublime Text Editor,
Example file with multiple lines
This is my Line 1 This is my Line 2 This is my Line 3 This is my Line 4 This is my Line 5
- Now press Control + H (or Command + H on macOS),
- Make sure you select .* button to enable RegEx,
- Now in Find: add \n (if windows encoding file) \r\n (if mac encoding)
- Add Replace: as "," (without the quotes).
- Click on REPLACE ALL! Thats it!
Output:
This is my Line 1,This is my Line 2,This is my Line 3,This is my Line 4,This is my Line 5
⛏️ Note: If you want to a space after each comma, just add a space after the comma ", " in Replace.
Let's me give you a gif demo to make it easy to follow,
More Posts related to Sublime-Text,
- Sublime Text 3 Convert Case to Upper, Lower, Title or Swap
- Change Sublime Text 3 white background color theme
- Replace new line with comma in Sublime Text Editor
- Word count in Sublime Text Editor
- How to add ruler in Sublime Text tab window
- How to Set Permanent ruler in Sublime Text
- How to install Packages in Sublime Text Editor
- Change Line Endings (Encoding Windows/Mac/Unix CR/LF/CRLF) Sublime Text
- Steps to Compare Two files in Sublime Text Side-by-Side
- How to find Sublime Text path of packages installed
- How to display File CR LF Newline Characters in Sublime Text
- How to add Multiple Rulers in Sublime Text
- How to shuffle lines randomly in Sublime Text
More Posts:
- Disable Control Scroll Zoom-in and Zoom-out in Notepad++ - NotepadPlusPlus
- Background task activation is spurious error - Windows 10, Office 2016, Office 365 - HowTos
- Fix: ModuleNotFoundError: No module named azure-core - Azure
- What is HTTP 500 Internal Server Error Code on web browsers - HowTos
- How to install curl on Alpine Linux - Linux
- Add X days from today in Command Line - HowTos
- Fix: >>> pip install - SyntaxError: invalid syntax - PIP
- Java TLSv1.3 protocol code example using SSLSocket - Java