Create a Chrome bookmark html file to import list of URLs

I recently switched RSS providers and I could only extract my saved posts as a list of URLs. So I thought I’d add these to a bookmark folder in Chrome. However, Chrome bookmark import only accepts a specifically formatted .html file.

So if you have a file with all your urls, name this file ‘url.txt’ and run this script to create a .html file that you can import in Chrome (hat-tip to GeoffreyPlitt).

#!/bin/bash
#
# Run this script on a file named urls.txt with all your URLs and pipe the output to an HTML file.
# Example: ./convert_url_file.sh > bookmarks.html

echo "<!DOCTYPE NETSCAPE-Bookmark-file-1>"
echo '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">'
echo '<TITLE>Bookmarks</TITLE>'
echo '<H1>Bookmarks</H1>'
echo '<DL><p>'
  cat urls.txt |
  while read L; do
    echo -n '    <DT><A HREF="';
        echo ''"$L"'">'"$L"'</A>';
  done
echo "</DL><p>"

Also published on Medium.

4 thoughts on “Create a Chrome bookmark html file to import list of URLs”

    1. Can’t thank you enough! I’ve been searching for this kind of tool for months. Works exactly as I wanted. Thanks man

  1. I am really thankfull to you Jan van den Berg and Aaron Atkins. Now I can easily export lots of Youtube URLs to raindrop and see if some video was deleted

Leave a Reply

Your email address will not be published. Required fields are marked *