Skip to Content.
Sympa Menu

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

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.
  • Date: Thu, 1 Mar 2007 14:49:19 +0000

On Thu, Mar 01, 2007 at 07:47:31PM +0000, sindi keesan wrote:
> My new Balinese translator penpal sent me what she said was a few photos,
> which is 186K of .doc file containing some long URLs at a German website,
> which contains the photos.
>
> This explains why doc2png found nothing.
>
> How do I extract the URLs (any string starting with http://) to a file
> that I can then access with lynx or links?

I gather that they aren't links, and note that they may begin with "www" as
well as "http".

Even if they are links, and as long as the entire url is on the
same line, this should do the trick:

#!/bin/sh

#script.sh
#usage: script.sh file_with_urls

echo "<html><head></head><body>" > newfile

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

echo "</body></html>" >> newfile

links newfile

-----------

There's a nifty little utility called "urlview" that does this very well. You
might
look into it.

[delete]
> Would anyone on the list under 30 like a Balinese penpal interested in
> languages and popular music for guitar and voice? One short email a week.
> She writes excellent English and has taught it. There might be others
> wanting penpals in her translation class.

I wouldn't be interested in talking to anyone who wasn't
interested in talking to people over 30 years of age.

They've shut themselves off from 99%+ of the wisest people on the
planet.

[delete]

Lee

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





Archive powered by MHonArc 2.6.24.

Top of Page