Add a script to convert a bookmarks file to bookmarks.db used by luakit - bookmarks.sh - Simple bookmark manager
(HTM) hg clone https://bitbucket.org/iamleot/bookmarks.sh
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) changeset 18aba69b87ddffdeb1d467f8601d6957c19acb90
(DIR) parent 4207926976cb05970685361a01b6c65622dece01
(HTM) Author: Leonardo Taccari <iamleot@gmail.com>
Date: Fri, 28 Sep 2018 01:36:20
Add a script to convert a bookmarks file to bookmarks.db used by luakit
Diffstat:
bookmarks2db.awk | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 60 insertions(+), 0 deletions(-)
---
diff -r 4207926976cb -r 18aba69b87dd bookmarks2db.awk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bookmarks2db.awk Fri Sep 28 01:36:20 2018 +0200
@@ -0,0 +1,60 @@
+#!/usr/bin/awk -f
+
+#
+# Copyright (c) 2018 Leonardo Taccari
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+#
+# Convert a bookmarks file to bookmarks.db for luakit.
+#
+# Usage:
+#
+# % bookmarks2db.awk < bookmarks | sqlite3 bookmarks.db
+#
+
+BEGIN {
+ FS = "\t"
+
+ print "CREATE TABLE bookmarks ("
+ print " id INTEGER PRIMARY KEY,"
+ print " uri TEXT NOT NULL,"
+ print " title TEXT NOT NULL,"
+ print " desc TEXT NOT NULL,"
+ print " tags TEXT NOT NULL,"
+ print " created INTEGER,"
+ print " modified INTEGER"
+ print ");"
+
+}
+
+{
+ tags = $3
+ gsub("@", "", tags)
+ gsub(",", " ", tags)
+
+ printf("INSERT INTO 'bookmarks' VALUES(%d,'%s','%s','%s','%s',%d,%d);\n",
+ NR, $2, $1, $4, tags, systime(), systime())
+}