如何将目录中 Markdown 文件里的 U+00A0 NBSP 替换为普通空格
如果你的目录中存在包含不换行空格(U+00A0,NBSP)的 Markdown 文件,并且希望将它们替换为普通空格(U+0020),可以在类 Unix 终端中使用以下命令:
此操作假设你的文件采用 UTF-8 编码! 建议使用 Git 管理 Markdown 文件,这样一旦出现问题可以轻松还原更改。
replace_nbsp.sh
find . -type f -name "*.md" -exec sed -i 's/\xc2\xa0/ /g' {} +If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow