Skip to content

Instantly share code, notes, and snippets.

@weibeld
Last active August 5, 2022 10:23
Show Gist options
  • Save weibeld/da640b77f1c5a029db283f2f4d9d0afc to your computer and use it in GitHub Desktop.
Save weibeld/da640b77f1c5a029db283f2f4d9d0afc to your computer and use it in GitHub Desktop.
Open Chrome bookmarks in new tab

Open Chrome bookmarks in new tab

Procedure for editing all bookmarks in Chrome so that they open in a new tab:

  1. Open Bookmark Manager
  2. Vertical dots (upper right corner) > Export bookmarks
  3. cat bookmarks_*.html | update-urls.sh >bookmarks_new.html
  4. Delete all bookmarks in Chrome
  5. Vertical dots (upper right corner) > Import bookmarks > Select bookmarks_new.html

Note: the script correctly handles bookmarks that it already processed previously, so it's safe to run it on partially updated bookmarks.

#!/bin/sh
sed '/javascript:window.open/!s/HREF="\([^"]*\)"/HREF="javascript:window.open(`\1`)"/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment