Skip to main content

With sed, you can do:

sed -e 's/\r$//'

The same way can do with tr, you only have to remove \r:

tr -d '\r'

although this will remove all instances of \r, not necessary followed by \n.

With sed, you can do:

sed -e 's/\r$//'

The same way can do with tr, you only have to remove \r:

tr -d '\r'

With sed, you can do:

sed 's/\r$//'

The same way can do with tr, you only have to remove \r:

tr -d '\r'

although this will remove all instances of \r, not necessary followed by \n.

ensure sed sees the carriage return just before the newline
Source Link
glenn jackman
  • 88.5k
  • 16
  • 124
  • 179

With sed, you can do:

sed -e 's/\r\r$//'

The same way can do with tr, you only have to remove \r:

tr -d '\r'

With sed, you can do:

sed -e 's/\r//'

The same way can do with tr, you only have to remove \r:

tr -d '\r'

With sed, you can do:

sed -e 's/\r$//'

The same way can do with tr, you only have to remove \r:

tr -d '\r'
Source Link
cuonglm
  • 158.1k
  • 41
  • 342
  • 420

With sed, you can do:

sed -e 's/\r//'

The same way can do with tr, you only have to remove \r:

tr -d '\r'