How to remove \r character with sed

后端 未结 2 833
轻奢々
轻奢々 2021-01-18 05:05

Very simply I have a file that has \\r\\n at every line break.

aaaa\\r\\nbbbb\\r\\ncccc

I would like to remove the \\r character while leav

相关标签:
2条回答
  • 2021-01-18 05:50

    You should be able to do it with sed like this:

    sed 's/\r//g' orig.txt > modified.txt
    
    0 讨论(0)
  • 2021-01-18 05:53

    In case you are using the terminal on a mac, use this instead to be able to recognize \r

    sed "s/$(printf '\r')\$//" orig.txt > modified.txt

    0 讨论(0)
提交回复
热议问题