Just a blog to share my tricks, code snippets

Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

Friday, June 30, 2017

Convert Windows's end of line characters into Unix, and vice verse, using Notepad++


The format of Windows and Unix text files differs slightly. DOS uses carriage return and line feed ("\r\n") as a line ending, which Unix uses just line feed ("\n"). That means when you write a bash script, for example, on windows and copy to to a Linux machine, executing it will result in errors.

  • Show end of line(EOL) characters: Go to View > Show Symbol > Show All Characters. In a unix text file, the end on line is the line feed("\n" or LF). In a windows text file, It shows ("\r\n" or CRLF)





  • To convert the a file from Windows to Unix text and vice verse: Go to Edit > EOL Conversion and then select the format you want.



  • Note: From the EOL Conversion menu, you can see the Mac also uses different end of line character ("\r" or CR)