用sed来替换正斜杠所有的反斜线 [英] Use sed to replace all backslashes with forward slashes
本文介绍了用sed来替换正斜杠所有的反斜线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望能够使用sed采取的输入,如:
C:\\ WINDOWS \\文件夹\\ FILE.TXT
要
C:/Windows/Folder/File.txt
解决方案
SED
可以在输入流从一个文件或从管道进行文本转换。例如:
回声C:\\富\\ bar.xml| SED的/ \\\\ / \\ // G'
可获得
C:/foo/bar.xml
I want to be able to use sed to take an input such as:
C:\Windows\Folder\File.txt
To
C:/Windows/Folder/File.txt
解决方案
sed
can perform text transformations on input stream from a file or from a pipeline. Example:
echo 'C:\foo\bar.xml' | sed 's/\\/\//g'
gets
C:/foo/bar.xml
这篇关于用sed来替换正斜杠所有的反斜线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文