Remove Carriage Return from Text File

I have a text file that is | delimited and is over 59,000 line long. How can I remove the carriage returns so each line is one record?

Here is what the current file looks like:-

Here is what I need it to look like:-

Any help would be awesome

2 Answers

Do a regular expression find/replace like this:

  • Open Replace Dialog
  • Find What: [^|\n\r]\R
  • Replace With: \1
  • check regular expression
  • click Replace or Replace All

It matches OS-linebreaks (\R) that are not (^) preceded by a | or \r or \n. Should work with any EOL convention.

In notepad++, you can actually open the search box, check the option for "extended search" in the search mode, and replace \R with blanks. This will help you replace the carriage return characters...

This also works for the other special chars such as \t, \n, etc.

Your Answer

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

David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.

Share this article
Twitter Facebook Pinterest