Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 07-30-2012
Registered User
 
Join Date: Feb 2010
Posts: 164
Thanks: 32
Thanked 4 Times in 4 Posts
Error Replace all \ in file with /

As the title says I want to replace all the '\' found in a file with '/'. I have tried with sed but with no luck so far!
Sponsored Links
    #2  
Old 07-30-2012
elixir_sinari's Avatar
Gotham Knight
 
Join Date: Mar 2012
Location: India
Posts: 1,370
Thanks: 87
Thanked 476 Times in 456 Posts

Code:
sed 's:\\:/:g' infile

The Following User Says Thank You to elixir_sinari For This Useful Post:
hakermania (07-30-2012)
Sponsored Links
    #3  
Old 07-30-2012
Registered User
 
Join Date: Feb 2010
Posts: 164
Thanks: 32
Thanked 4 Times in 4 Posts
Quote:
Originally Posted by elixir_sinari View Post
Code:
sed 's:\\:/:g' infile

It works just fine

Thanks!
    #4  
Old 07-30-2012
bmk bmk is offline
Registered User
 
Join Date: Dec 2011
Posts: 258
Thanks: 1
Thanked 22 Times in 22 Posts
One more solutions...

Code:
tr '\' '/' <test.txt

The Following User Says Thank You to bmk For This Useful Post:
hakermania (07-30-2012)
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Optimised way for search & replace a value on one line in a very huge file (File Size is 24 GB). manishkomar007 Shell Programming and Scripting 7 09-02-2011 10:59 PM
script to grep a pattern from file compare contents with another file and replace namitai Shell Programming and Scripting 2 08-30-2011 01:31 PM
Read file and for each line replace two variables, add strings and save output in another file Andy_ARG Shell Programming and Scripting 5 03-03-2011 12:25 AM
how can search a String in one text file and replace the whole line in another file kkraja UNIX for Dummies Questions & Answers 6 08-06-2008 07:23 AM
serach and replace file name in the path in a remote xml file kiranreddy1215 Shell Programming and Scripting 1 11-12-2007 10:31 AM



All times are GMT -4. The time now is 05:19 PM.