Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Searching for links in a file

Status
Not open for further replies.

Jma1091

Programmer
May 2, 2005
1
GB


I'm fairly new to awk. I want to search files and output the links to webpages within the file in order of apperance.

I've used a reguluar expression to search the file:

/http/,/html?/

i've tried various methods to list the links without the html tags and tried using an array to count the apperance of links but to no avail.

any help would be appreciated.
 
I punched "html links" into the search function on this page, and found this: thread271-543906
 
Code:
BEGIN { FS = "<[aA][ \t]+(href|HREF) *= *\"" }

{ for (f=2; f<=NF; f++)
    print substr( $f, 1, index($f, "\"") - 1 )
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top