A short while back, after exporting my blog from WordPress to Hugo I noticed that there were some weird
^M characters in some files as shown in the following screenshot in blue.
This is a special character,
CTRL+M and can be removed using
vim. Using vim we can replace/substitute a text with the following command:
Therefore, we should be able to replace
^M, by typing
CTRL+M, with an empty space as so:
Since I have lots of random files containing
^M, it’d be easier to use
sed from the command line instead.
❯❯❯ sed -i 's/^M//g' *.md
--in-placeedit files in place.
For more information, you can check out the tutorial listed in the reference below.