Skip to Content.
Sympa Menu

baslinux - Re: [BL] script to extract http://'s from a doc. 5A

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: sindi keesan <keesan AT sdf.lonestar.org>
  • To: Lee Forrest <lforrestster AT gmail.com>
  • Cc: baslinux AT lists.ibiblio.org
  • Subject: Re: [BL] script to extract http://'s from a doc. 5A
  • Date: Fri, 2 Mar 2007 02:58:37 +0000 (UTC)

On Thu, 1 Mar 2007, Lee Forrest wrote:

On Thu, Mar 01, 2007 at 02:49:19PM +0000, Lee Forrest wrote:
[delete]

First script was sloppy. This truly deals with links, puts
"http://"; in front of "www", uses the original url from the
file as the link name so that you can see which link is which,
and puts ".html" at the end of the resultant file so that a
browser knows it is to be interpreted as an html doc.

#!/bin/sh

#script.sh

#usage: script.sh file_with_urls

echo "<html><head></head><body>" > links.html

sed -n 's@^\(.*\)\(http://\|www\)\([^ ><"]*\)\(.*\)@<p><a href="\2\3">\2\3</a>@p' "$1" | sed
's@\"www@\"http://www@' >> links.html

echo "</body></html>" >> links.html

links links.html

[delete]

This produced a file called links.html with only the html tags.




Archive powered by MHonArc 2.6.24.

Top of Page