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: Lee Forrest <lforrestster AT gmail.com>
  • To: baslinux AT lists.ibiblio.org, keesan AT sdf.lonestar.org
  • Subject: Re: [BL] script to extract http://'s from a doc. 5A
  • Date: Thu, 1 Mar 2007 18:39:24 +0000

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]

Lee

--
BasicLinux: Small is Beautiful
http://www.basiclinux.com.ru





Archive powered by MHonArc 2.6.24.

Top of Page