无法弄清楚这个perl字符串替换

时间:2021-09-06 21:11:11

I want to convert every occurrence of "\\192.168.0.2\" with "q:\"

我想用“q:\”转换每次出现的“\\ 192.168.0.2 \”

So far I've come up with:

到目前为止,我想出了:

perl -i.bak -pe 's/\\\\192.168.0.2\\/q:\\/' report.txt

This doesn't change anything in the file. I could use some guidance! Thanks

这不会改变文件中的任何内容。我可以用一些指导!谢谢

sample: file type processed 10/29/2012 9:08:58 AM \\192.168.0.2\reports\ report.xls

sample:文件类型已处理10/29/2012 9:08:58 AM \\ 192.168.0.2 \ reports \ report.xls

1 个解决方案

#1


3  

perl -i.bak -pe "s/\\\\192\.168\.0\.2\\/q:\\/" report.txt

Note the double quotes

请注意双引号

#1


3  

perl -i.bak -pe "s/\\\\192\.168\.0\.2\\/q:\\/" report.txt

Note the double quotes

请注意双引号