Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 03-30-2006, 02:00 AM   #1
LQ Newbie
Registered: Aug 2005
Posts: 6

Rep: Reputation: 0
sed problem

I want to replace "\" with "" in a file
what command should I input in order to achieve it?
Old 03-30-2006, 04:11 AM   #2
Andrew Benton
Senior Member
Registered: Aug 2003
Location: Birkenhead/Britain
Distribution: Linux From Scratch
Posts: 2,073

Rep: Reputation: 64
I'm not sure if you wanted the "" included so it's either
sed -i 's,\\,,g' test.txt
sed -i 's,"\\","",g' test.txt

Last edited by Andrew Benton; 03-30-2006 at 04:15 AM.
Old 03-30-2006, 04:51 AM   #3
LQ Newbie
Registered: Aug 2005
Posts: 6

Original Poster
Rep: Reputation: 0
Thanks for your answer.
However I have another queation.

I want to use sed in DOS condition,and want to change the string "\" into "" ,However the above method does not work, How can I change the command.
Old 03-30-2006, 07:31 AM   #4
Senior Member
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
To change just one character, you maybe better off using "tr" (transliteration) instead of "sed" (stream editor, works on a line-by-line behaviour).


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sed problem twintornado Programming 2 06-02-2005 08:25 AM
a sed problem thanhVic Programming 5 03-02-2005 01:05 AM
sed problem fossilet Linux - Software 4 12-26-2004 05:44 AM
sed problem Warmduvet Programming 2 09-15-2004 06:33 PM
Insert character into a line with sed? & variables in sed? jago25_98 Programming 5 03-11-2004 06:12 AM

All times are GMT -5. The time now is 07:54 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration