Line-end agnostic diff?

后端 未结 7 1723
醉梦人生
醉梦人生 2021-01-01 14:19

I\'m working on a Mac, with some fairly old files. Different files were created by different programs, so some of them end with \\r (Mac) and some with \\n (Unix). I want to

7条回答
  •  一生所求
    2021-01-01 14:30

    As Jay said, Diff'nPatch seems what you are looking for. Alternatively you can convert all your '\r' line endings in '\n' in a single command like this:

    sed -ie 's/\r/\n/' filename
    

    or

    find . | xargs -n1 sed -ie 's/\r/\n/'
    

    (You may want to filter the list of files in some way in the latter case or it will be applied to all the files in all subdirectories.)

提交回复
热议问题