LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 05-17-2011, 08:27 AM   #1
vishesh
Member
 
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 661

Rep: Reputation: 66
sed code to replace character


This is what i doing to remove ( and )
sed 's/(//'|sed 's/)//'
)

Can you offer me some better sed code that remove ( and ) with blank without using pipe (|) . I mean sed code that check ( or ) and replace that with blank character.
 
Old 05-17-2011, 08:57 AM   #2
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,698

Rep: Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988
Code:
sed 's/[()]/ /g'
 
1 members found this post helpful.
Old 05-17-2011, 09:01 AM   #3
crts
Senior Member
 
Registered: Jan 2010
Posts: 1,604

Rep: Reputation: 446Reputation: 446Reputation: 446Reputation: 446Reputation: 446
Hi,

both
Code:
sed 's/(\|)//g'
sed 's/[()]//g'
should work equally well.

EDIT:
grail was faster.
I do have a question for the OP, though. You say that you want to replace the braces with a blank character. However, in your example you simply delete them. Please clarify.

Last edited by crts; 05-17-2011 at 09:06 AM.
 
1 members found this post helpful.
  


Reply

Tags
replace, sed


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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] sed help - replace line feed with different character bradvan Programming 7 04-23-2012 12:31 AM
if and sed - how to check character and then replace depending on result redhatuser1 Linux - Newbie 36 10-28-2010 08:03 AM
How to replace a character with the output of some commands using sed? mamun2015 Linux - Newbie 18 03-16-2010 11:50 AM
Replace 2nd to last Character with SED elproducto Programming 5 03-31-2009 01:41 PM
Insert character into a line with sed? & variables in sed? jago25_98 Programming 5 03-11-2004 07:12 AM


All times are GMT -5. The time now is 04:39 AM.

Main Menu
Advertisement
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