0
I have a HTML file containing the code for an image map with over 200 links, like this:
<area shape="RECT" coords="410, 7, 438, 35" href="/ItemDetails.jsp?item=os_landranger_1"/>
The problem is, the actual links are incorrect: I need to replace them with correct URLs, which are derived from a product title and reference number, which I have in a CSV file.
Essentially I need a specialised Find and Replace that will read the first link, get the title and ref. no. from the CSV, and enter them into the HTML in the correct format (i.e. with spaces replaced with _) before going onto the next one, and so on. The links need to come out the other end like this:
<area shape="RECT" coords="410, 7, 438, 35" href="product/1_-_Shetland_%C2%96_Yell%2C_Unst_and_Fetlar_9780319228074" />
In this case the title in the CSV would read '1 - Shetland - Yell, Unst and Fetlar' and the ref. no. would be 9780319228074
Is there any way I can do this, preferably for free?
EDIT:
I've managed to do this using Excel. I first imported the tags into a blank workbook as a CSV, telling Excel to use " as the delimiter. I then imported the title list into a new column and then reconstructed the tag in an empty cell with the & operator using the title list to replace the old URL. A bit of find and replace to convert commas and ampersands to HTML codes, then copying and pasting of the formula to the rest of the rows, and voila, success.
Thanks to everyone who answered.
What OS is your server running? *nix has utilities such as sed that could do this for you. – Chris Ting – 2011-06-02T13:56:21.153
The second is what the e-commerce system generates from the title and ref. no. entered during product creation. I am using Windows but have access to OS X if necessary. – ElendilTheTall – 2011-06-02T14:47:29.280