Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在linux中修复测试文件中的windows字符?_Windows_Linux_File - Fatal编程技术网

如何在linux中修复测试文件中的windows字符?

如何在linux中修复测试文件中的windows字符?,windows,linux,file,Windows,Linux,File,我已从Windows复制了文件。 在Vi中,我看到^M不允许工作。 AFAIK这是将文件从Windows移动到Linux的问题。 有可能修复吗? 谢谢。如果您使用的是vim(增强型vi编辑器),您可以在编辑器中正确操作: 切换到命令模式:按ESC键 类型 瞧——) 否则,如果安装了dos2unx实用程序,则可以使用该实用程序删除^M(\r): 否则,您可以使用理解替换的GNU sed: sed -e 's/\r$//' infile.txt > outfile.txt 如果您使用的是vi

我已从Windows复制了文件。 在Vi中,我看到^M不允许工作。 AFAIK这是将文件从Windows移动到Linux的问题。 有可能修复吗? 谢谢。

如果您使用的是vim(增强型vi编辑器),您可以在编辑器中正确操作:

  • 切换到命令模式:按ESC键
  • 类型
  • 瞧——)

    否则,如果安装了
    dos2unx
    实用程序,则可以使用该实用程序删除
    ^M
    (\r):

    否则,您可以使用理解替换的GNU sed:

    sed -e 's/\r$//' infile.txt > outfile.txt
    
    如果您使用的是vim(增强型vi编辑器),则可以在编辑器中正确操作:

  • 切换到命令模式:按ESC键
  • 类型
  • 瞧——)

    否则,如果安装了
    dos2unx
    实用程序,则可以使用该实用程序删除
    ^M
    (\r):

    否则,您可以使用理解替换的GNU sed:

    sed -e 's/\r$//' infile.txt > outfile.txt
    
    这里已经回答了-这里已经回答了-
    sed -e 's/\r$//' infile.txt > outfile.txt