There is no "CF" character in Notepad++. The "CR LF" symbols that may appear are non-printing characters that represent line endings and are shown only when the "Show All Characters" feature is enabled.
To remove these line endings, you need to use Notepad++'s built-in Find and Replace function, which can target these special characters.
Using Find and Replace to delete CR LF
This method is the most reliable and gives you precise control over what you replace.
- Open the Replace dialog.
- Navigate to the menu bar and click Search > Replace... or use the shortcut
Ctrl+H.
- Navigate to the menu bar and click Search > Replace... or use the shortcut
- Enable the "Extended" search mode.
- In the Replace dialog box, look for the Search Mode section at the bottom.
- Select the Extended (\n, \r, \t, \0, \x...) option. This allows you to search for special characters using escape codes.
- Enter the character codes.
- In the Find what: box, enter
\r\n. This represents the "CR LF" sequence used on Windows machines. - The Replace with: box should be left completely empty to delete the line endings. Alternatively, you can add a space () if you want to join the lines with a space.
- In the Find what: box, enter
- Execute the replacement.
- Click the Replace All button. Notepad++ will scan your document and remove every instance of the CR LF sequence.
Understanding the CR LF symbols
When you enable View > Show Symbol > Show All Characters, you will see special symbols that represent non-printable characters.
- CR: Stands for "Carriage Return" and is represented by
\r. - LF: Stands for "Line Feed" and is represented by
\n. - CR LF: The combination
\r\nis the standard line ending on Windows, which signals both a carriage return and a new line.
Other common symbols you might see include:
- A dot (
.): Represents a space character. - An arrow (
→): Represents a tab character.
Disabling the visible symbols
If you simply want to hide the symbols and are not concerned with deleting the underlying characters, you can turn off the "Show All Characters" setting.
- Navigate to View > Show Symbol.
- Uncheck the Show All Characters option. This will hide the CR LF and other non-printing characters from your view, but they will still be present in the file data.
Using Regular Expressions for advanced removal
For more complex scenarios, you can use Regular Expressions for more targeted removal of line endings.
- Open the Replace dialog (
Ctrl+H) and select Regular expression as the search mode. - To remove empty lines:
- In the Find what: box, enter
^\s*$\r\nto find lines that are empty or contain only whitespace. - Leave the Replace with: box empty.
- In the Find what: box, enter
- To join lines with a specific delimiter:
- In the Find what: box, enter
\r\n. - In the Replace with: box, enter the delimiter you want to use, for example, a comma and a space (
,).
- In the Find what: box, enter
Final considerations
- Backup your file: Before performing a "Replace All" operation on a critical file, it is always a good idea to make a backup. This ensures you can revert your changes if something goes wrong.
- File type and encoding: Be aware that line endings can differ between operating systems. Windows uses
CR LF(\r\n), Unix/Linux usesLF(\n), and older Mac systems usedCR(\r). In most cases, Notepad++ will automatically detect the correct type, but for a different type, you would need to adjust your search pattern (e.g., use\ninstead of\r\n).