LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 03-30-2006, 02:00 AM   #1
Hydrap
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
Code:
sed -i 's,\\,,g' test.txt
or
Code:
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
Hydrap
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
timmeke
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).
 
  


Reply


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 06:11 PM.

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