Skip to content

Files

72_line_endings

LINE ENDINGS

Demonstrate some examples of working with line-endings differences.

Reason

When switching between WSL and Windows line endings will sometimes be converted.

NOTES:

  • It seems if VSCode detects line endings it continues to use that style.

VSCode Extension

Use a code extension to render the line endings.

code --install-extension medo64.render-crlf

Tools

sudo apt install dos2unix

Start

# show line endings
cat --show-all ./dos.txt
# show file type
file ./dos.txt 


# show line endings
cat --show-all ./unix.txt
# show file type
file ./unix.txt 

Convert

dos2unix ./dos.txt
cat --show-all ./dos.txt 

unix2dos ./unix.txt
cat --show-all ./unix.txt 

Resources

  • How to find out line-endings in a text file? here