On 08/08/2018 08:34 AM, Daniel wrote:
Richard Owlett wrote on 8/08/2018 10:38 PM:
My bookmarks have grown like Topsy I have many duplicates and the
tree structure is a mess. I have two primary goals: 1. find and purge
duplicates. 2. move folders around to create a more reasonable
structure.

After trying several approaches and looking for useful tools I found jq [https://stedolan.github.io/jq/]. One related page I found is
titled "jq is sed for JSON".

An outline of a possible procedure might be:
1. Export SeaMonkey bookmarks in JSON format.
2. use jq to pretty print the JSON. It does so nicely.
3. Find duplicate targets and delete all but one.
4. Each leaf of the bookmark tree is an object. Move these objects >around to create a more friendly tree.
5. Import the clean organized bookmarks.

Has anyone done this? Is there a friendly in depth jq tutorial? The
ones I've found tend to be on the "Hello world" level. There is just
enough to tantalize.

Links of interest include: https://stedolan.github.io/jq/manual/v1.5/ http://stedolan.github.io/jq/tutorial/ https://robots.thoughtbot.com/jq-is-sed-for-json

Richard, you have my attention! About a month ago, I asked, here, about sorting out duplicate, or even triplicate, entries in the Bookmarks folder.

I've got zero experience with JSON, but will be interested in any discussion here!


If you know the bookmark's title or uri you can do it manually.
Use the bookmarks manager to export in JSON format.
Make a copy in another directory to manipulate.
Run jq's pretty print function to create a file to edit.
Open with a plain text editor (notebook etc).

Search for your duplicated book mark.

A sample from my system is:


                {
                  "guid": "yb3hKkKKqQSh",
                  "title": "Debootstrap (Shallow Thoughts)",
                  "index": 1,
                  "dateAdded": 1487768687157000,
                  "lastModified": 1487768687157000,
                  "id": 34488,
                  "iconuri": "http://shallowsky.com/favicon.ico";,
                  "type": "text/x-moz-place",
                  "uri": 
"http://shallowsky.com/blog/linux/install/debootstrap.html";
                },
.
.
.

                        {
                          "guid": "hvuonjDqIu5X",
                          "title": "Debootstrap (Shallow Thoughts)",
                          "index": 2,
                          "dateAdded": 1488384546925000,
                          "lastModified": 1488384546925000,
                          "id": 34549,
                          "iconuri": "http://shallowsky.com/favicon.ico";,
                          "type": "text/x-moz-place",
                          "uri": 
"http://shallowsky.com/blog/linux/install/debootstrap.html";
                        },



Note the different indentations. That is an indicator of how deeply nested that occurrence is.

Delete everything "{" to "}" inclusive. If there is a comma after the closing brace, delete it also.

Repeat for other duplicates.

Use the bookmark manager's restore function to load the edited JSON.
There should be no problem. You did start with a backup didn't you?
<grin>

I'm looking to automate it as I have no idea which have duplicates.
HTH


_______________________________________________
support-seamonkey mailing list
[email protected]
https://lists.mozilla.org/listinfo/support-seamonkey

Reply via email to