Remove carriage return in Unix

后端 未结 21 2278
傲寒
傲寒 2020-11-22 03:40

What is the simplest way to remove all the carriage returns \\r from a file in Unix?

21条回答
  •  青春惊慌失措
    2020-11-22 04:05

    Once more a solution... Because there's always one more:

    perl -i -pe 's/\r//' filename
    

    It's nice because it's in place and works in every flavor of unix/linux I've worked with.

提交回复
热议问题