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

前端 未结 11 1056
一向
一向 2020-11-28 00:15

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

11条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-28 00:57

    In the bash shell, try cat -v . This should display carriage-returns for windows files.

    (This worked for me in rxvt via Cygwin on Windows XP).

    Editor's note: cat -v visualizes \r (CR) chars. as ^M. Thus, line-ending \r\n sequences will display as ^M at the end of each output line. cat -e will additionally visualize \n, namely as $. (cat -et will additionally visualize tab chars. as ^I.)

提交回复
热议问题