Tuesday, June 6, 2017

Remove CTRL-M characters from a file in UNIX

Recently one of my files started getting these ^M characters at the end of each line. I wanted to remove them quickly and use sed to remove them



sed -i "s/^M//" filename
You need to enter ^M by pressing Ctrl and then pressing V and M in succession



Remove CTRL-M characters from a file in UNIX

No comments:

Post a Comment