Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
google site



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

Closed Thread
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-18-2009
Registered User
 

Join Date: Oct 2008
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
Need to grab URL and place between <A></A> Tags

my output looks like:

Code:
<A HREF="http://support.apple.com/kb/HT1629"> </A>
<A HREF="http://support.apple.com/kb/HT1200"> </A>
<A HREF="http://old.nabble.com/AFP-eating-up-CPU-td19976358.html"> </A>
<A HREF="http://jochsner.dyndns.org/scripts/NHR.html"> </A>
<A HREF="http://jochsner.dyndns.org/scripts/NHR.html"> </A>
<A HREF="http://go2xserve.com/"> </A>
<A HREF="http://go2xserve.com/"> </A>
<A HREF="http://www.afp548.com/article.php?story=MCXRedirector"> </A>
<A HREF="http://www.afp548.com/article.php?story=MCXRedirector"> </A>
<A HREF="http://rentzsch.com/macosx/fs_usageIntro"> </A>
<A HREF="http://support.apple.com/kb/HT2370"> </A>

I need to grab each URL from http until the ending double quotes and place it between the > and </A>


Example:
<A HREF="http://support.apple.com/kb/HT2370"> </A>

should become

<A HREF="http://support.apple.com/kb/HT2370">Apple Remote Desktop: Configuring remotely via command line (kickstart) </A>

Last edited by scottn; 12-18-2009 at 07:31 PM.. Reason: Added code tags
Sponsored Links
  #2  
Old 12-18-2009
Registered User
 

Join Date: Dec 2009
Location: Dallas, TX
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
So, you mean you want to insert the text in between there?
  #3  
Old 12-18-2009
Registered User
 

Join Date: Oct 2008
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
woops, I meant I want the URL from the same line to be inserted there.. In my example it translated the link
  #4  
Old 12-18-2009
Ghostdog (Read Only)
 

Join Date: Dec 2009
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts

Code:
gawk '/<A HREF=/ {
 o=$0
 gsub(/<A HREF=\042|\042>.*/,"",o)
 link=o
 gsub(/> <\/A>/,">"link"</A>")
 print
}' file

Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
What is the best way to copy data from place to another place? unitipon Solaris 9 11-16-2009 10:34 AM
SSH Grab n' Go unimachead OS X (Apple) 0 10-15-2009 05:57 PM
Grab a smaller and larger value Raynon Shell Programming and Scripting 3 10-11-2007 06:23 AM
grab the line using awk cdfd123 Shell Programming and Scripting 1 10-10-2007 08:21 AM
How to grab data between 2 strings ? Raynon Shell Programming and Scripting 16 10-06-2006 10:37 AM



All times are GMT -4. The time now is 08:01 AM.