Posted By: Anonymous
I’m trying to use something in bash to show me the line endings in a file printed rather than interpreted. The file is a dump from SSIS/SQL Server being read in by a Linux machine for processing.
Are there any switches within
In addition to seeing the line-endings, I need to know what type of line end it is (
LF). How do I find that out?
You can use the
file utility to give you an indication of the type of line endings.
$ file testfile1.txt testfile.txt: ASCII text
$ file testfile2.txt testfile2.txt: ASCII text, with CRLF line terminators
To convert from “DOS” to Unix:
$ dos2unix testfile2.txt
To convert from Unix to “DOS”:
$ unix2dos testfile1.txt
Converting an already converted file has no effect so it’s safe to run blindly (i.e. without testing the format first) although the usual disclaimers apply, as always.