Friday, May 14, 2010

So you have a bunch of IE Favorites and want to take them to Firefox

BUT you forgot to export them to HTML before you nuked Windows.
You need a way to parse the URL file and strip out the URL= field, adding it to an a href and using the filename as the bookmark name. I use tofrodos to fix the ^Ms in the files, they really mess with awk's output.

cd /mnt/sdb1/Doc*/Jodie/Favorites
fromdos *.url
awk -F"URL=" '/^URL=/ { sub(/.url$/,NULL,FILENAME); print "<a href=\""$2"\">"FILENAME"</a><br>" }' *.url > out.html


Now import `out.html` into Firefox. Ta-da!
(Blogger tried really hard to eat that HTML. First example had sed stripping the .url from FILENAME, but I realized I could have awk do that.)


-Jodie