THE SQL Server Blog Spot on the Web

Welcome to SQLblog.com - The SQL Server blog spot on the web Sign in | |
in Search

Jamie Thomson

This is the blog of Jamie Thomson, a freelance data mangler in London

Replacing CRLF with LF using Notepad++

I’m putting this here for my own future reference as much as anything else however if anyone ever bingles their way here it should be useful for them too.

I have a text file that has CRLF line terminators (which Windows uses to terminate lines) that I want to replace with LF line terminators (the UNIX way). Notepad++ demonstrates this rather well:

image

Notepad++’s Find/Replace feature handles this requirement quite nicely. Simply bring up the Replace dialog (CTRL+H), select Extended search mode (ALT+X), search for “\r\n” and replace with “\n”:

image

Hit Replace All (ALT+A)….and job’s a good’un:

image

Easy when you know how!!!

@jamiet

UPDATE, turns out there’s an even easier way. From Eugene in the comments below:

Another option is to go to Edit -> EOL Conversion -> Unix Format.

Published Tuesday, August 07, 2012 12:50 PM by jamiet
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Eugene said:

Another option is to go to Edit -> EOL Conversion -> Unix Format.

August 7, 2012 7:14 AM
 

jamiet said:

Eugene,

I did NOT know that.

Awesome

August 7, 2012 7:31 AM
 

jbooker said:

Good to know about extended option.  

There's also a more advanced Find\Replace here:

TextFX | TextFx Quick | Find\Replace

This allows you to copy & paste multi-line char strings into F & R boxes.

August 7, 2012 9:13 AM
 

Paul said:

Thanks! I knew how to do this in Word but now I know Notepad++ too

November 6, 2012 8:47 AM
 

Alex said:

Thanks for this Blog and also Eugene's comment. You guys just solved my problem!

December 17, 2012 1:13 PM
 

Dan C said:

Thank you. This helped me solve this issue!

January 10, 2013 12:50 PM
 

Vernon said:

Thank you Eugene and Jamie,

February 18, 2013 9:16 PM
 

Veera Prasad said:

Thanks..this helps me a lot

February 26, 2013 10:34 AM
 

PU2MIX said:

Thanks...

April 2, 2013 7:45 AM
 

Jan said:

Thank you!

October 22, 2013 5:04 PM
 

Gab said:

Thanksssssssssssalot!

October 30, 2013 10:56 AM
 

Ratanang said:

Super, Thanks a lot guys, you came to my rescue

October 30, 2013 12:05 PM
 

Rado said:

Thank You!

November 29, 2013 9:26 AM

Leave a Comment

(required) 
(required) 
Submit

This Blog

Syndication

Powered by Community Server (Commercial Edition), by Telligent Systems
  Privacy Statement