I have many, many, many links like:
http://www.foo.com/ http://www.bar.com/
with one per line, in a text file. is there a simple way to convert that to
<a href="http://www.foo.com/">foo</a>
or something similar, so that the links are "clickable" in mozilla?
It's not a html question per se, or maybe it is, I dunno :)
I imagine that a script could do it, but I don't know how to write a script (at least nothing like that).
Any thoughts?
Actually, I always found it annoying that microsoft word makes links clickable whether you want that or not. Hey, maybe I found a use for that "feature" :)
Thanks,
Thufir
THUFIR HAWAT wrote:
I have many, many, many links like:
http://www.foo.com/ http://www.bar.com/
with one per line, in a text file. is there a simple way to convert that to
<a href="http://www.foo.com/">foo</a>
or something similar, so that the links are "clickable" in mozilla?
It's not a html question per se, or maybe it is, I dunno :)
I imagine that a script could do it, but I don't know how to write a script (at least nothing like that).
Any thoughts?
Actually, I always found it annoying that microsoft word makes links clickable whether you want that or not. Hey, maybe I found a use for that "feature" :)
Thanks,
Thufir
Thufir, I'm not certain that I completely understand your question.
From what I understand, this would be very simple to do with a short perl script.
If this is indeed what you'd like to do, mail me off-list and I will help you with it.
Thanks, Mike
On Sun, Jul 31, 2005 at 08:31:21AM +0100, THUFIR HAWAT wrote:
I have many, many, many links like:
http://www.foo.com/ http://www.bar.com/
with one per line, in a text file. is there a simple way to convert that to
<a href="http://www.foo.com/">foo</a>
or something similar, so that the links are "clickable" in mozilla?
It's not a html question per se, or maybe it is, I dunno :)
I imagine that a script could do it, but I don't know how to write a script (at least nothing like that).
Any thoughts?
Actually, I always found it annoying that microsoft word makes links clickable whether you want that or not. Hey, maybe I found a use for that "feature" :)
This may not be what you what but if you copy the text into an open office document they will be clickable links.
Am So, den 31.07.2005 schrieb THUFIR HAWAT um 9:31:
I have many, many, many links like:
http://www.foo.com/ http://www.bar.com/
with one per line, in a text file. is there a simple way to convert that to
<a href="http://www.foo.com/">foo</a>
Thufir
sed 's|^http://%5C(.*%5C)/%7C<a href="\1">\1</a>|g; s|href="|href="http://%7Cg' linklist.txt > clicklist.txt
Alexander
On 7/31/05, Alexander Dalloz ad+lists@uni-x.org wrote: ...
sed 's|^http://%5C(.*%5C)/%7C<a href="\1">\1</a>|g; s|href="|href="http://%7Cg' linklist.txt > clicklist.txt
Alexander
Thanks, Alexander. I did:
[thufir@arrakis click]$ [thufir@arrakis click]$ [thufir@arrakis click]$ [thufir@arrakis click]$ date Sun Jul 31 15:41:46 IST 2005 [thufir@arrakis click]$ pwd /home/thufir/click [thufir@arrakis click]$ ll total 24 -rw-rw-r-- 1 thufir thufir 5366 Jul 31 08:37 clicklist.txt -rw-rw-r-- 1 thufir thufir 5366 Jul 31 15:38 clicklist.txt.backup [thufir@arrakis click]$ sed 's|^http://%5C(.*%5C)/%7C<a href="\1">\1</a>|g; s|href="|href="http://%7Cg'
linklist.txt > clicklist.txt
[thufir@arrakis click]$
about how long should this take? I gave the command 60 seconds and hit ctrl-c to cancel it. examining clicklist.txt shows no change.
Aha, I might've provided faulty data. The links aren't all of the form
but more like
http://ipac3.vpl.ca/ipac20/ipac.jsp?uri=full=3100001~!1221436~!17&ri=42&...
is that the problem?
Thanks,
Thufir
On Sun, 2005-07-31 at 15:47 +0100, THUFIR HAWAT wrote:
On 7/31/05, Alexander Dalloz ad+lists@uni-x.org wrote: ...
sed 's|^http://%5C(.*%5C)/%7C<a href="\1">\1</a>|g; s|href="|href="http://%7Cg' linklist.txt > clicklist.txt
^^^^^^^^^^ ^^^^^^^^^^^^
Note that Alexander gave you (examples of) an input file and an output file that are different. You will need to use 2 different filenames for sed to work. The input file must exist, the output file will be created.
In your command below, the input file does not exist so it cannot perform the task. This is seen in the output of your 'll' command.
Alexander
Thanks, Alexander. I did:
[thufir@arrakis click]$ [thufir@arrakis click]$ [thufir@arrakis click]$ [thufir@arrakis click]$ date Sun Jul 31 15:41:46 IST 2005 [thufir@arrakis click]$ pwd /home/thufir/click [thufir@arrakis click]$ ll total 24 -rw-rw-r-- 1 thufir thufir 5366 Jul 31 08:37 clicklist.txt -rw-rw-r-- 1 thufir thufir 5366 Jul 31 15:38 clicklist.txt.backup [thufir@arrakis click]$ sed 's|^http://%5C(.*%5C)/%7C<a href="\1">\1</a>|g; s|href="|href="http://%7Cg'
linklist.txt > clicklist.txt
[thufir@arrakis click]$
about how long should this take? I gave the command 60 seconds and hit ctrl-c to cancel it. examining clicklist.txt shows no change.
Aha, I might've provided faulty data. The links aren't all of the form
but more like
http://ipac3.vpl.ca/ipac20/ipac.jsp?uri=full=3100001~!1221436~!17&ri=42&...
is that the problem?
Thanks,
Thufir
Hello,
On Sun, 31 Jul 2005 10:40:05 -0500 Jeff Vian wrote:
Alexander Dalloz wrote: ...
sed 's|^http://%5C(.*%5C)/%7C<a href="\1">\1</a>|g; s|href="| href="http://%7Cg' linklist.txt > clicklist.txt
^^^^^^^^^^ ^^^^^^^^^^^^Note that Alexander gave you (examples of) an input file and an output file that are different. You will need to use 2 different filenames for sed to work. The input file must exist, the output file will be created.
In your command below, the input file does not exist so it cannot perform the task. This is seen in the output of your 'll' command.
I think you do understand, now.
Thanks, Alexander. I did:
[thufir@arrakis click]$ [thufir@arrakis click]$ [thufir@arrakis click]$ [thufir@arrakis click]$ date Sun Jul 31 15:41:46 IST 2005 [thufir@arrakis click]$ pwd /home/thufir/click [thufir@arrakis click]$ ll total 24 -rw-rw-r-- 1 thufir thufir 5366 Jul 31 08:37 clicklist.txt -rw-rw-r-- 1 thufir thufir 5366 Jul 31 15:38 clicklist.txt.backup [thufir@arrakis click]$ sed 's|^http://%5C(.*%5C)/%7C<a href="\1">\1</a>| g; s|href="|href="http://%7Cg'
linklist.txt > clicklist.txt
about how long should this take? I gave the command 60 seconds and hit ctrl-c to cancel it. examining clicklist.txt shows no change.
Aha, I might've provided faulty data. The links aren't all of the form
but more like
http://ipac3.vpl.ca/ipac20/ipac.jsp?uri=...
is that the problem?
Thanks,
Thufir
Try this:
$ sed 's|^http://%5C(.*/%5C)%5C(.*%5C)%7C<a href="\1\2">\1</a>|g; s|href="| href="http://%7Cg' /input/file/with/links > /output/file/with/clicklinks
It's minimal changed from the first example, which didn't things well when i tried it out with your uri.
Thomas
On 7/31/05, Thomas Springer th.springer@gmx.net wrote: ...
Try this:
$ sed 's|^http://%5C(.*/%5C)%5C(.*%5C)%7C<a href="\1\2">\1</a>|g; s|href="| href="http://%7Cg' /input/file/with/links > /output/file/with/clicklinks
It's minimal changed from the first example, which didn't things well when i tried it out with your uri.
Thomas
...
Sorry that I didn't notice that sed was using input and output files, should've seen that.
I made a dummy with just one link to test the sed command. The link is entirely on one line, where as if I were to paste it here then it would wrap, I'm not sure if that's relevant.
Here's the link in dumm.txt, wrapped:
http://ipac3.vpl.ca/ipac20/ipac.jsp?uri=full=3100001~!1150206~!25&ri=4&aspect=basic_search$
[thufir@arrakis click]$ [thufir@arrakis click]$ date Sun Jul 31 21:26:23 IST 2005 [thufir@arrakis click]$ pwd /home/thufir/click [thufir@arrakis click]$ ll total 36 -rw-rw-r-- 1 thufir thufir 0 Jul 31 21:26 clicklist.txt -rw-rw-r-- 1 thufir thufir 95 Jul 31 21:26 dummy.txt -rw-rw-r-- 1 thufir thufir 5366 Jul 31 08:37 linklist.txt -rw-rw-r-- 1 thufir thufir 5366 Jul 31 15:38 linklist.txt.backup [thufir@arrakis click]$ cat dummy.txt http://ipac3.vpl.ca/ipac20/ipac.jsp?uri=full=3100001~!1150206~!25&ri=4&a...
[thufir@arrakis click]$ sed 's|^http://%5C(.*/%5C)%5C(.*%5C)%7C<a href="\1\2">\1</a>|g; s|href="| href="http://%7Cg' dummy.txt > clicklist.txt sed: -e expression #1, char 58: unterminated `s' command [thufir@arrakis click]$
I opened "dummy.txt" from openoffice and the link wasn't clickable, but I do notice that if I were to e-mail these to myself that they become clickable from gmail. Still, I'd like to get the sed command working, partly out of curiousity.
Thanks,
Thufir
Am So, den 31.07.2005 schrieb THUFIR HAWAT um 22:50:
[thufir@arrakis click]$ cat dummy.txt http://ipac3.vpl.ca/ipac20/ipac.jsp?uri=full=3100001~!1150206~!25&ri=4&a...
[thufir@arrakis click]$ sed 's|^http://%5C(.*/%5C)%5C(.*%5C)%7C<a href="\1\2">\1</a>|g; s|href="| href="http://%7Cg' dummy.txt > clicklist.txt sed: -e expression #1, char 58: unterminated `s' command [thufir@arrakis click]$
What you show here can't be what you really entered. Do not wrap lines. The sed command is one single line.
Thufir
Alexander
On Sun, 31 Jul 2005 21:50:15 +0100 THUFIR HAWAT wrote:
On 7/31/05, Thomas Springer th.springer@gmx.net wrote: ...
Try this:
$ sed 's|^http://%5C(.*/%5C)%5C(.*%5C)%7C<a href="\1\2">\1</a>|g; s|href="| href="http://%7Cg' /input/file/with/links > /output/file/with/ clicklinks
It's minimal changed from the first example, which didn't things well when i tried it out with your uri.
Thomas
...
Sorry that I didn't notice that sed was using input and output files, should've seen that.
I made a dummy with just one link to test the sed command. The link is entirely on one line, where as if I were to paste it here then it would wrap, I'm not sure if that's relevant.
Here's the link in dumm.txt, wrapped:
http://ipac3.vpl.ca/ipac20/ipac.jsp?uri=full=3100001~!1150206~!25&ri=4&aspect=basic_search$
[thufir@arrakis click]$ date Sun Jul 31 21:26:23 IST 2005 [thufir@arrakis click]$ pwd /home/thufir/click [thufir@arrakis click]$ ll total 36 -rw-rw-r-- 1 thufir thufir 0 Jul 31 21:26 clicklist.txt -rw-rw-r-- 1 thufir thufir 95 Jul 31 21:26 dummy.txt -rw-rw-r-- 1 thufir thufir 5366 Jul 31 08:37 linklist.txt -rw-rw-r-- 1 thufir thufir 5366 Jul 31 15:38 linklist.txt.backup [thufir@arrakis click]$ cat dummy.txt http://ipac3.vpl.ca/ipac20/ipac.jsp?uri=full=3100001~!1150206~!25&ri=4&a...
[thufir@arrakis click]$ sed 's|^http://%5C(.*/%5C)%5C(.*%5C)%7C<a href="\1\2">\1</a>|g; s|href="| href="http://%7Cg' dummy.txt > clicklist.txt sed: -e expression #1, char 58: unterminated `s' command [thufir@arrakis click]$
I opened "dummy.txt" from openoffice and the link wasn't clickable, but I do notice that if I were to e-mail these to myself that they become clickable from gmail. Still, I'd like to get the sed command working, partly out of curiousity.
Thanks,
Thufir
It goes like this,
$ sed 's|^http://%5C(.*/%5C)%5C(.*%5C)%7C<a href="\1\2">\1</a>|g;
s|href="| href="http://%7Cg' dummy.txt > clicklist.txt
$ echo $? 0 $ cat clicklist.txt <a href="http://ipac3.vpl.ca/ipac20/ipac.js..">ipac3.vpl.ca/ipac20/</a>
Sorry,I can't see why it doesn't work for you.
Try again, or use the file which comes with this message.
* Save, * make it executable, then * ./clinks.sh inputfile > outputfile
Thomas
On Sun, 2005-07-31 at 08:31 +0100, THUFIR HAWAT wrote:
I have many, many, many links like:
http://www.foo.com/ http://www.bar.com/
with one per line, in a text file. is there a simple way to convert that to
<a href="http://www.foo.com/">foo</a>
or something similar, so that the links are "clickable" in mozilla?
If you use firefox, you can install the Linkification extensions which does exactly what you want. After installing it, just open the text.file in firefox and all the URLs will be clickable.
Linkification: Converts text links into geniune, clickable links.
https://addons.mozilla.org/extensions/moreinfo.php?id=190