找到控制 m 个字符并将其删除 [英] Find control m characters and remove it
问题描述
是否有任何单行命令可以递归查找所有目录中的 .ctl 文件并从中删除控制 m 字符?
Is there is any single line command to recursively find the .ctl file in all the directories and remove the control m characters from it?
推荐答案
dos2unix为解决这个问题而生.
您可以通过 find 或任何程序找到所有目标文件,然后
You can locate all the target files by find or whatever program, then
dos2unix filename
这个问题的背景(来自Dominique)
让我们解释一下这是什么:在 UNIX 中,ENTER 被翻译为 chr(13)(回车的 ASCII 码),在 DOS (Windows) 中,ENTER 被翻译为 chr(13)+chr(10)(回车返回结合换行符).当您在 UNIX 中打开 Windows 文本文件时,您会看到 chr(10) 字符(您不想要).提到的 dos2unix 命令搜索该 chr(13)+chr(10) 并删除 chr(10) 字符.– 多米尼克
Let's explain what this is about: in UNIX, ENTER is translated as chr(13) (ASCII-code of carriage return), in DOS (Windows) ENTER is translated as chr(13)+chr(10) (carriage return combined with newline character). When you open a Windows textfile in UNIX, you see that chr(10) character (which you don't want). The mentioned dos2unix command searches for that chr(13)+chr(10) and removes the chr(10) characters. – Dominique
这篇关于找到控制 m 个字符并将其删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!