LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 11-18-2011, 04:59 AM   #1
guessity
Member
 
Registered: Dec 2009
Posts: 41

Rep: Reputation: 15
Red face Sed replace Help replace for (<a>


I am trying to replace
Code:
(<a href="http://www.google.com" target="_blank">Google</a>)
to
Code:
Google
with sed. I did the following and it did not work for some reason -

Code:
find /home/tst -type f -exec sed -i "s#(<a href="http://www.google.com" target="_blank">Google</a>)#Google#g" {} \;
any idea where I went wrong?

Sorry I figured it out. Mods can delete the thread.

Code:
find /home/tst -type f -exec sed -i 's#(<a href="http://www.google.com" target="_blank">Google</a>)##g' {} \;

Last edited by guessity; 11-18-2011 at 05:24 AM.
 
Old 11-18-2011, 09:05 AM   #2
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 5,953
Blog Entries: 5

Rep: Reputation: 755Reputation: 755Reputation: 755Reputation: 755Reputation: 755Reputation: 755Reputation: 755
Mods won't delete the thread because it contains a solution. It helps others with the same question to find it later.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Using File as Replace in Sed abercrombieande Programming 9 03-04-2011 02:55 PM
how to replace with variable using sed? babag Programming 4 09-17-2008 03:28 PM
How do I replace ' with sed.... @ngelot Linux - Newbie 2 11-02-2007 07:04 PM
SED - replace / insert furquan Programming 5 03-01-2006 06:58 PM
problem in perl replace command with slash (/) in search/replace string ramesh_ps1 Red Hat 4 09-10-2003 01:04 AM


All times are GMT -5. The time now is 11:07 AM.

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