LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

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


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

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
Open Source Consulting | Domain Registration