Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.8k views
in Technique[技术] by (71.8m points)

bash - Use sed to replace all backslashes with forward slashes

I want to be able to use sed to take an input such as:

C:WindowsFolderFile.txt

to

C:/Windows/Folder/File.txt
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

sed can perform text transformations on input stream from a file or from a pipeline. Example:

echo 'C:fooar.xml' | sed 's/\///g'

gets

C:/foo/bar.xml

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...