[英]command to convert windows path to unix path using cygwin inside a file
I need to convert a windows path to unix path inside a file before running make. 我需要在运行make之前将Windows路径转换为文件内的Unix路径。 I m running a make build using windows box because of one software(IDE). 由于一个软件(IDE),我正在使用Windows Box运行make build。 So using cygwin to run the build. 因此,使用cygwin运行构建。
The windows path is: Windows路径为:
c:/Program Files (x86)/xxxxxx/Bin/xxx.exe
and wants to change to: 并希望更改为:
/cygdrive/c/Program Files/xxxxx/Bin/xxxx.exe
I know i can use cygpath but that will only give me the converted unix path. 我知道我可以使用cygpath,但这只会给我转换后的Unix路径。 I was thinking may be if i can use a sed command to make the change inside the file. 我当时在想,是否可以使用sed命令在文件中进行更改。
I m new to unix so if someone can help and give me the complete command that will be a great help 我是unix的新手,所以如果有人可以帮忙并给我完整的命令,那将是非常有用的
Thanks in advance 提前致谢
sed -i 's#c:/Program Files (x86)/#/cygdrive/c/Program Files#' YourFile
做这个工作,但是你们中的人来自winDOwS世界路径分隔符与unix不同,通常是\\
,在这种情况下,您当然需要
sed -i 's#c:\\Program Files (x86)\\#/cygdrive/c/Program Files#;s#\\#/#g' YourFile
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.