baslinux AT lists.ibiblio.org
Subject: Baslinux mailing list
List archive
- 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.
- Date: Fri, 2 Mar 2007 02:53:38 +0000 (UTC)
On Thu, 1 Mar 2007, Lee Forrest wrote:
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".
These all start with "http:// and end with .html" or .jpg"
I can't tell if the URLs are on one line when viewing with 'less'.
Like most MS files this was mostly repetitive garbage. It looked like one very long line that wrapped a lot.
Even if they are links, and as long as the entire url is on the
same line, this should do the trick:
I cut all but the following to a file which I made executable:
#!/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
I called it urlextract.
urlextract file.doc
There was nothing in newfile but the HTML tags.
The output file should end in .htm or .html to be recognized as html.
I don't think you need the head and body parts just to access the links.
The input file had one link to an online html file and four to jpg files.
-----------
There's a nifty little utility called "urlview" that does this very well. You
might
look into it.
It also extracts things like mailto and has a bunch of dependencies. A small script should be adequate for my purpose.
Lee
-
[BL] script to extract http://'s from a doc.,
sindi keesan, 03/01/2007
-
Re: [BL] script to extract http://'s from a doc.,
Lee Forrest, 03/01/2007
-
Re: [BL] script to extract http://'s from a doc. 5A,
Lee Forrest, 03/01/2007
-
Re: [BL] script to extract http://'s from a doc. 5A,
sindi keesan, 03/01/2007
- Re: [BL] script to extract http://'s from a doc. 5B, Lee Forrest, 03/01/2007
-
Re: [BL] script to extract http://'s from a doc. 5C,
Lee Forrest, 03/01/2007
- Re: [BL] script to extract http://'s from a doc. 5C, sindi keesan, 03/02/2007
-
Re: [BL] script to extract http://'s from a doc. 5A,
sindi keesan, 03/01/2007
- Re: [BL] script to extract http://'s from a doc., sindi keesan, 03/01/2007
-
Re: [BL] script to extract http://'s from a doc. 5A,
Lee Forrest, 03/01/2007
-
Re: [BL] script to extract http://'s from a doc.,
Samual Acorn, 03/02/2007
-
Re: [BL] script to extract http://'s from a doc.,
sindi keesan, 03/02/2007
-
Re: [BL] script to extract http://'s from a doc.,
3aoo-cvfd, 03/02/2007
-
Re: [BL] script to extract http://'s from a doc.,
sindi keesan, 03/03/2007
- Re: [BL] script to extract http://'s from a doc., sindi keesan, 03/03/2007
-
Re: [BL] script to extract http://'s from a doc. 5F,
Lee Forrest, 03/03/2007
-
Re: [BL] script to extract http://'s from a doc. 5F,
sindi keesan, 03/03/2007
-
Message not available
- Re: [BL] script to extract http://'s from a doc. 60, sindi keesan, 03/04/2007
-
Message not available
-
Re: [BL] script to extract http://'s from a doc. 5F,
sindi keesan, 03/03/2007
-
Re: [BL] script to extract http://'s from a doc.,
sindi keesan, 03/03/2007
-
Re: [BL] script to extract http://'s from a doc.,
3aoo-cvfd, 03/02/2007
-
Re: [BL] script to extract http://'s from a doc.,
sindi keesan, 03/02/2007
- Re: [BL] script to extract http://'s from a doc., sindi keesan, 03/03/2007
-
Re: [BL] script to extract http://'s from a doc.,
Lee Forrest, 03/01/2007
Archive powered by MHonArc 2.6.24.