Converting A Plain Text List Of URLs Into An HTML List of Clickable Links
February 21, 2006 10:11 AM
Subscribe
What's the easiest way to convert a plain text list of URLs with descriptions into an HTML page of clickable links?
I have a long list of URLs and descriptions in a plain text file, formatted like so
### This is a page about monkeys
http://www.monkeypage.com
### This is a page about weasels
http://www.weaselpage.com
and would like to convert them into an XHTML list formatted like so
This is a page about monkeys
This is a page about weasels
What would be the best way to do a conversion like this? I'm running OS 10.4.5, and I'm guessing a good method would involve command line stuff I'm aware of but don't really understand - regular expressions, grep, and the like. Alternatively, since the resulting page is destined for the web, I suppose another option would be a PHP or Perl script to convert the text file on the fly (I only mention PHP and Perl because I have some, very limited, experience with them, and would be lost if someone suggested, eg., a Python solution). I also assume some of the more advanced text editors would be up to the job (though from what I've seen of them, I'm a bit intimidated by the likes of vim or emacs!)
If this is a simple proposition, I'd be very grateful if someone could give examples of commands/possible scripts, if not, pointers to resources about manipulating text files in this way would be great too (I keep everything in plain text files, so am keen to learn about manipulating and repurposing them in general).
posted by jack_mo to computers & internet (9 comments total)
<li><a title="This is a page about monkeys" href="http://www.monkeypage.com">This is a page about monkeys</a></li><li><a title="This is a page about weasels" href="http://www.weaselpage.com">This is a page about weasels</a></li>
posted by jack_mo at 10:12 AM on February 21, 2006