THE SQL Server Blog Spot on the Web

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

Jamie Thomson

This is the blog of Jamie Thomson, a data mangler in London working for Dunnhumby

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:


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”:


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


Easy when you know how!!!


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 7, 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



Eugene said:

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

August 7, 2012 7:14 AM

jamiet said:


I did NOT know that.


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:


April 2, 2013 7:45 AM

Jan said:

Thank you!

October 22, 2013 5:04 PM

Gab said:


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

dv said:

thanks mate!

June 24, 2014 9:48 AM

Martin said:

Thank you!    

July 5, 2014 6:44 AM

MR said:

I didn't realise the problem I was introducing using Notepad to edit a pac file i.e. the CRs at the end of the line.    Having stumbled across the need to use Notepad++, this page was just what I needed.   Everything explained as simply and crisply as possible.  Brilliant. Many thanks for your forethought and generosity in putting this information on the Web "for future reference"     Looks like it's getting quite a bit of that!

July 6, 2014 3:41 PM

Adrian B. said:

Thank you!

September 23, 2014 4:32 AM

Gail W said:

I googled "how to change crlf to lf" and this was the first result. Considering that I use Notepad++ as my editor, I was delighted to get something that was exactly what I needed. I had a feeling there might be a command in Notepad++, I just hadn't looked in the right place.


October 7, 2014 3:11 PM

Don said:

Seems like this will go on helping people (like me) for a while to come, so thanks a lot Jamie. I just suddenly saw all these CRLFs appear in my Notepad++ document and still can't tell what I did to get them there.

Wanted to get rid of them and Google got me here. So many thumbs up to people like you who are willing to put things up to help people like me.

October 17, 2014 4:12 PM

Christine said:


October 28, 2014 11:10 AM

Anupama said:

Thank you. It was helpful for me

October 29, 2014 2:50 AM

Tom W said:

Ditto Gail W's comments!

December 15, 2014 4:10 PM

Andrew said:

Thanks heaps for the info guys, both to Jamiet and Eugene :D

February 11, 2015 11:52 AM

Anatoly said:

Thanks a lot!

February 15, 2015 10:27 PM

David said:

Just what I needed. Cool!

April 14, 2015 10:59 AM

wiz said:

Thank you so much for this solved my problem.

May 1, 2015 9:27 AM

Neo said:

This helped me a lot! thx!!

May 6, 2015 10:28 AM

Tony said:

Thank you also. I couldn't make the EOL=Unix work yesterday and didn't realize that I could use the escaped \r\n in Search & Replace. I'll know what to do next time I get a 150,000 line log file and I want to see more lines on the screen.

June 11, 2015 4:47 PM

i max said:

thanks, solved my problem.

June 24, 2015 5:19 AM

Sebastian said:

Thank you dude!

June 24, 2015 7:44 AM

ats said:


June 26, 2015 2:52 AM

Steve said:

I love seeing old threads that are still relevant!

July 13, 2015 1:07 PM

keith said:

me too

September 8, 2015 11:31 AM

fishyho said:

u are my saviour...

if not u said

EOL conversion _> unix.

my job cannot be done...

thank you so much......

thx for help me removing

November 6, 2015 3:38 AM

Sana said:

It helped a lot

November 12, 2015 9:10 AM

Anthony said:

Useful tip, thanks.

I had to do convert the other way, from LF to CR/LF, on a file created by a new-fangled distributed app so I could FTP to a mainframe for processing by a *REAL* computer.

One of my colleagues in the UNIX crèche told me about this great toy he plays with, Notepad++, but I still needed Google and this page to work out how to use it.

November 19, 2015 6:40 AM

DXA said:

Thanks for the article.

It helped me a lot.

November 25, 2015 1:17 PM

Mary said:

Whew ~ you saved me a lot of time.


December 22, 2015 5:28 PM

Naveen said:

Thanks yaar.... keep on updating

February 3, 2016 1:47 AM

xdr said:

I needed to do this automatically for a folder, so notepad++ wasn't enough. I ended up writing this python script if anyone interested (fix a whole folder while skipping git folders):

import fileter

class NormalizeLF(fileter.FilesIterator):

   def process_file(self, path, dryrun):

       with open(path, 'rb') as infile:

           buff =

           buff = buff.replace("\r\n", "\n")

       with open(path, 'wb') as outfile:


it = NormalizeLF()

it.add_filter_by_pattern(["*/.git/*"], it.FilterType.Exclude)



April 3, 2016 3:00 PM

WAW said:

You guys rock.  I had to go the other way, UNIX to Windows and that feature had the reverse available for me.  Thanks again!

April 28, 2016 10:34 AM

Beniton said:

Thanks Eugene and Jamie

June 7, 2016 3:44 AM

Williams said:

Thanks so much!  We normally have systems doing the file creation, but we had an emergency fix and thanks to you and Google - we were able to do this manually in Notepad++.  What sis we do before Google?

June 10, 2016 5:42 PM

Linh said:

Thank for the article.

June 21, 2016 5:50 AM

Filipus said:

small useful info! thanks!

August 1, 2016 5:03 AM

SQUIDmaster said:

Outstanding, thanks heaps

August 4, 2016 1:44 AM

Anne said:

Thank you for the article - I'd been trying to do this too! EOL easy can it get!

October 18, 2016 9:21 AM

nicole alondra said:

Lost file ?

Try File Search Tool

January 23, 2017 6:03 AM

nils said:

Helped! Thanks a lot!

March 1, 2017 9:22 AM

David said:

Useful information, clean and simple. Great stuff!

April 5, 2017 9:20 AM

Doric said:

Excellent. Thanks a lot !

May 16, 2017 4:43 AM

Baskar said:

Thanks a lot.. great solution and simple.

May 23, 2017 10:37 AM

Ever Mas said:

Great Stuff.

June 1, 2017 9:18 AM

Leave a Comment


This Blog


Privacy Statement