How to determine the line ending of a file

前端 未结 7 1799
忘掉有多难
忘掉有多难 2020-12-23 09:32

I have a bunch (hundreds) of files that are supposed to have Unix line endings. I strongly suspect that some of them have Windows line endings, and I want to programmaticall

7条回答
  •  南方客
    南方客 (楼主)
    2020-12-23 09:53

    You can use the file tool, which will tell you the type of line ending. Or, you could just use dos2unix -U which will convert everything to Unix line endings, regardless of what it started with.

提交回复
热议问题