Results 1 to 3 of 3
Hi Everyone
I hope you will help me with my little problem, I am not very experienced with Linux.
I have got a fille which contains something like :
.\home\user\readme.txt
...
- 05-04-2009 #1Just Joined!
- Join Date
- May 2009
- Posts
- 2
sed from "\" to "/"
Hi Everyone
I hope you will help me with my little problem, I am not very experienced with Linux.
I have got a fille which contains something like :
.\home\user\readme.txt
.\home\user\results.txt
.\home\user\abc.txt
filenames in Windows notations. I need to convert it into Linux notation i.e. replace "\" symbol with "/" symbol. Sed is the first thing which comes into my head. BUT the problem is SED uses "/" symbol to separate parameters. I tried to use another separator (":") but still doesn't work.
Anyone can suggest a method/tool to substitute "\" with "/" in a file/stream ?
Thanks in advance for any help.
Regards
ksv689
- 05-05-2009 #2
You need to "escape" the \
However, if you try to do this from the command line, the shell with try to interpret the escapes.
Create a file (sedcmd) with this line in it:
s/\//\\/g
Then from the command line...
sed -f sedcmd < inputfile > outputfile
- 05-05-2009 #3Just Joined!
- Join Date
- May 2009
- Posts
- 2
Hi cheapscotchron
Tahnks a lot, worked well for me.
Actually running just
sed 's/\\/\//g' > outfile
was good enough.


Reply With Quote