LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   convert DOS style (https://www.linuxquestions.org/questions/linux-newbie-8/convert-dos-style-881839/)

nardo 05-20-2011 12:07 PM

convert DOS style
 
How do I write a script to convert all DOS style backslashes to UNIX style slashes in a list of files /

corp769 05-20-2011 12:42 PM

Hello,

I have found a thread similar to this, locate here: http://www.linuxquestions.org/questi...kslash-136312/

Hope that helps man!

Cheers,

Josh

spazticclown 05-20-2011 01:30 PM

Using the slashes in the sed command can be confusing.

Try
Code:

sed 's#\\#\/#g' < filename.txt
In this example instead of using '\' as the separator between sed fields I used '#' to make it more readable, I also escaped the '/' and '\' just to be sure it knew what to do. What it does is substitute '\' with '/' and then 'g' for global in the stream (in this case filename.txt).

MTK358 05-20-2011 01:48 PM

There's no need to escape the forward-slash is you use a different delimiter.


All times are GMT -5. The time now is 11:56 PM.