Skip to main content
The 2024 Developer Survey results are live! See the results

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

10
  • 30
    Unfortunately, I don't think vi can show those specific characters. You can try od -c <filename> which I believe will display \n or \r\n. Commented Aug 25, 2010 at 22:51
  • 3
    In the "for what it's worth" category you can grep for Dos style CRLF by issuing grep --regex="^M" where ^M is CTRL+V CTRL+M. You can remove those by replacing those with a sed command. This does essentially the same thing as dos2unix
    – cowboydan
    Commented Oct 28, 2012 at 22:33
  • 14
    In vim: :set fileformat will report which of unix or dos vim thinks the file's line endings are in. You can change it by :set fileformat=unix. Commented Jun 18, 2013 at 16:09
  • 8
    Use the -b flag when starting vi/vim and then use :set list to see CR (^M) and LF ($) endings.
    – Samuel
    Commented Mar 31, 2015 at 0:59
  • 1
    @RyanBerger - Looks like you're missing a -t. It should be od -t c file/path, but thanks for the new program. Worked great! Commented Sep 26, 2016 at 16:25