A short while back, after exporting my blog from WordPress to Hugo I noticed that there are some weird
^M character in some files as shown in the following screenshot in blue.
This is a special character,
CTRL+M and can be removed using
vim. Normally, in vim we can reaplace a text with the following command:
So we should be able to replace
^M, by typing
CTRL+M with empty space with:
Since I have lots of random files containing
^M, it’d be easier to use
sed from the command line as the following:
❯❯❯ sed -i 's/^M//g' *.md
--in-placedit files in places
Thanks to the tutorial found in the reference.