[Notepad++] Remove CR Carriage Return and LF Line feed (CRLF)


Let's see how we can find and replace CR (Carriage Return) and LF (Line Feed) characters from a file using Notepad++ application on the Windows operating system.

First let's see what their characters are,

Carriage Return (CR): Also know as Cartridge return,

It is a control character used to reset the position of the cursor to the beginning of the next line of a text file.

Symbol : ↵
Unicode : U+21B5
HTML Entity : ↵
ASCII : 13
Programming Languages: \r
Note: It is also known as Control+M character and may be seen as ^M

Line Feed (LF): Also known as Newline Character or End Of Line Character (EOF) or line break. It is a special character used to signify the end of a line of text and the start of a new line in a file.

Symbol : ␤
Unicode: U+000A
HTML Entity : 
ASCII: 10
Programming Languages: \n
CRLF Relation:

Carriage return and Line feed are very much associated with each other and hence you would see both of them clubbed together as CR+LF or LF+CR, CRLF or LFCR

How to find CRLF characters using Notepad++

You can use a regular expression to find CRLF character,

  1. Open file in Notepad++
  2. Goto Find,
  3. Make sure that in Search Mode, the Regular Expression option is selected.
  4. In "Find what" add regular expression [\r\n]+
  5. Now you should see CRLF characters highlighted.
How to find and replace CRLF using Notepad++

You can use a regular expression to find CRLF character,

  1. Open file in Notepad++
  2. Goto Find & Replace,
  3. Make sure that in Search Mode, the Regular Expression option is selected.
  4. In "Find what" add regular expression [\r\n]+ and in Replace with : \n
  5. CRLF will be replaced with a newline character.
Note: There is an easier way available in the later versions of Notepad++
  1. Go to Edit -> EOL Conversion
  2. Select Windows Format
Advertisements
Try Out Code2care Dev Tools:

Advertisements



Android Java Linux Microsoft Google Python macOS Notepad++ Microsoft Teams CSS PHP SharePoint Html Linux C Programs Bootstrap jQuery Sublime Android Studio Facebook Eclipse WhatsApp News MySQL Json HowTos JavaScript FTP S3


Advertisements


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and Software Developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include Learnings, Tutorials, Trouble-Shooting steps, Video Tutorials, Code Snippets, How Tos, Blogs, Articles, etc.
🎉 We are celebrating the 10th years of Code2care! Thank you for all your support! We hope we made a difference.
We strong support Gender Equality & Diversity.

We stand in solidarity with Ukraine - Make a donation to UNHCR - https://donate.unhcr.org/in/en-in/ukraine-emergency