Search and replace new lines in Vim

Reading Time: 1 minute


 When using the search and replace feature in Vim (:%s/search/replace/), you must use \n to search for new line characters and \r to replace them with new line characters.

Example of replacing new line characters with commas:


Example of replacing commas with new line characters:


We transform challenges into digital experiences

Get in touch to let us know what you’re looking for. Our policy includes 14 days risk-free!

Free project consultation