Using jq to clean/organize bookmarks?

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





0
Richard
8/8/2018 12:38:04 PM
mozilla.support.seamonkey 12968 articles. 0 followers. Post Follow

26 Replies
51 Views

Similar Articles

[PageSpeed] 2

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!

-- 
Daniel

User agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101
SeaMonkey/2.49.1 Build identifier: 20171016030418

User agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
SeaMonkey/2.49.1 Build identifier: 20171015235623
0
Daniel
8/8/2018 1:34:26 PM
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


0
Richard
8/8/2018 2:41:43 PM
On 08/08/2018 09:41 AM, Richard Owlett wrote:
> 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=20
>>> >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/=
=20
>>> http://stedolan.github.io/jq/tutorial/=20
>>> https://robots.thoughtbot.com/jq-is-sed-for-json
>>>
>> Richard, you have my attention! About a month ago, I asked, here,=20
>> about sorting out duplicate, or even triplicate, entries in the=20
>> Bookmarks folder.
>>
>> I've got zero experience with JSON, but will be interested in any=20
>> discussion here!
>>
>=20
> 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).
>=20
> Search for your duplicated book mark.
>=20
> A sample from my system is:
>=20
>>
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0 {
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "guid": "yb3hKkKKqQSh",
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "title": "Debootstrap (Shallow Thoughts)",=

>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "index": 1,
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "dateAdded": 1487768687157000,
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "lastModified": 1487768687157000,
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "id": 34488,
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "iconuri": "http://shallowsky.com/favicon.=
ico",
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "type": "text/x-moz-place",
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "uri":=20
>> "http://shallowsky.com/blog/linux/install/debootstrap.html"
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0 },
>> .
>> .
>> .
>>
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 {
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 "guid": "hvuonjDqIu5X",
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 "title": "Debootstrap (Shallow Thoughts)",
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 "index": 2,
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 "dateAdded": 1488384546925000,
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 "lastModified": 1488384546925000,
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 "id": 34549,
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 "iconuri": "http://shallowsky.com/favicon.ico",
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 "type": "text/x-moz-place",
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 "uri":=20
>> "http://shallowsky.com/blog/linux/install/debootstrap.html"
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 },
>>
>=20
>=20
> Note the different indentations. That is an indicator of how deeply=20
> nested that occurrence is.
>=20
> Delete everything "{" to "}" inclusive. If there is a comma after the=20
> closing brace, delete it also.
>=20
> Repeat for other duplicates.
>=20
> 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>
>=20
> I'm looking to automate it as I have no idea which have duplicates.
> HTH
>=20
>=20

I've blocked out a method to list all unique titles and purge=20
duplicates. Hopefully I'll have something workable early next weeks.



0
Richard
8/8/2018 6:09:24 PM
Richard Owlett wrote on 9/08/2018 4:09 AM:
> On 08/08/2018 09:41 AM, Richard Owlett wrote:
>> 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
> 
> I've blocked out a method to list all unique titles and purge 
> duplicates. Hopefully I'll have something workable early next weeks.
> 
Hey, I've been waiting a couple of months, Richard, a couple of weeks 
more should be no problem. Best of luck with your endeavours!

-- 
Daniel

User agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101
SeaMonkey/2.49.1 Build identifier: 20171016030418

User agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
SeaMonkey/2.49.1 Build identifier: 20171015235623
0
Daniel
8/9/2018 7:49:18 AM
On 08/09/2018 02:49 AM, Daniel wrote:
> Richard Owlett wrote on 9/08/2018 4:09 AM:
>> On 08/08/2018 09:41 AM, Richard Owlett wrote:
>>> 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:=20
>>>>> https://stedolan.github.io/jq/manual/v1.5/=20
>>>>> http://stedolan.github.io/jq/tutorial/=20
>>>>> https://robots.thoughtbot.com/jq-is-sed-for-json
>>>>>
>>>> Richard, you have my attention! About a month ago, I asked, here,
>>>> =C2=A0about sorting out duplicate, or even triplicate, entries in th=
e
>>>> =C2=A0Bookmarks folder.
>>>>
>>>> I've got zero experience with JSON, but will be interested in any
>>>> =C2=A0discussion 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,=20
>>>> "lastModified": 1487768687157000, "id": 34488, "iconuri":
>>>> "http://shallowsky.com/favicon.ico", "type": "text/x-moz-place",=20
>>>> "uri": "http://shallowsky.com/blog/linux/install/debootstrap.html"=20
>>>> }, . . .
>>>>
>>>> { "guid": "hvuonjDqIu5X", "title": "Debootstrap (Shallow
>>>> Thoughts)", "index": 2, "dateAdded": 1488384546925000,=20
>>>> "lastModified": 1488384546925000, "id": 34549, "iconuri":=20
>>>> "http://shallowsky.com/favicon.ico", "type": "text/x-moz-place",=20
>>>> "uri": "http://shallowsky.com/blog/linux/install/debootstrap.html" }=
,
>>>
>>> Note the different indentations. That is an indicator of how deeply
>>> =C2=A0nested 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
>>
>> I've blocked out a method to list all unique titles and purge=20
>> duplicates. Hopefully I'll have something workable early next weeks.
>>
> Hey, I've been waiting a couple of months, Richard, a couple of weeks=20
> more should be no problem. Best of luck with your endeavours!
>=20

Have made progress :]
BUT creating useful output in JSON format acceptable to SeaMonkey=20
unlikely :[

HOWEVER I expect I'll be able to create a HTML file which can serve=20
nicely as bookmarks. That was one of my initial alternative goals.

My path to that will depend on Linux tools. I suspect similar tools=20
exist in Windows. I will be creating a description of my combination of=20
scripts and manual edits.



0
Richard
8/18/2018 3:44:04 AM
Richard Owlett wrote on 18/08/2018 1:44 PM:
> On 08/09/2018 02:49 AM, Daniel wrote:
>> Richard Owlett wrote on 9/08/2018 4:09 AM:
>>> On 08/08/2018 09:41 AM, Richard Owlett wrote:
>>>> 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
>>>
>>> I've blocked out a method to list all unique titles and purge 
>>> duplicates. Hopefully I'll have something workable early next weeks.
>>>
>> Hey, I've been waiting a couple of months, Richard, a couple of weeks 
>> more should be no problem. Best of luck with your endeavours!
>>
> 
> Have made progress :]
> BUT creating useful output in JSON format acceptable to SeaMonkey 
> unlikely :[

Boo! Hiss!!

> HOWEVER I expect I'll be able to create a HTML file which can serve 
> nicely as bookmarks. That was one of my initial alternative goals.

SeaMonkey used to, natively, I think, do this!!

Yes, Bookmarks->Manage Bookmarks then, in the Bookmark Manager, 
Tools->Export HTML....

Maybe that's a way ... Export as HTML, then edit the HTML file directly.

> My path to that will depend on Linux tools. I suspect similar tools 
> exist in Windows. I will be creating a description of my combination of 
> scripts and manual edits.

Thanks for your continued efforts, Richard.

-- 
Daniel

User agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 
SeaMonkey/2.49.1 Build identifier: 20171016030418

User agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 
SeaMonkey/2.49.1 Build identifier: 20171015235623
0
Daniel
8/18/2018 9:50:12 AM
On 08/18/2018 04:50 AM, Daniel wrote:
> Richard Owlett wrote on 18/08/2018 1:44 PM:
>> [snip]
>> Have made progress :]
>> BUT creating useful output in JSON format acceptable to SeaMonkey 
>> unlikely :[
> 
> Boo! Hiss!!

That's life ;/

> 
>> HOWEVER I expect I'll be able to create a HTML file which can serve 
>> nicely as bookmarks. That was one of my initial alternative goals.
> 
> SeaMonkey used to, natively, I think, do this!!
> 
> Yes, Bookmarks->Manage Bookmarks then, in the Bookmark Manager, 
> Tools->Export HTML....

That exists. But almost useless for my needs.
It loses the hierarchical information. My bookmarks include both links 
and folders containing links. Nested several levels deep.

> 
> Maybe that's a way ... Export as HTML, then edit the HTML file directly.
> 
>> My path to that will depend on Linux tools. I suspect similar tools 
>> exist in Windows. I will be creating a description of my combination 
>> of scripts and manual edits.
> 
> Thanks for your continued efforts, Richard.
> 

0
Richard
8/18/2018 10:25:03 AM
On 8/18/18, Richard Owlett <rowlett@cloud85.net> wrote:
> On 08/18/2018 04:50 AM, Daniel wrote:
>> Richard Owlett wrote on 18/08/2018 1:44 PM:
>>> [snip]
>>> Have made progress :]
>>> BUT creating useful output in JSON format acceptable to SeaMonkey
>>> unlikely :[

  Bookmarks / Manage Bookmarks
  Tools / Restore / Choose / Choose File
seems likely to work.  Or have you already tried that?

>>> HOWEVER I expect I'll be able to create a HTML file which can serve
>>> nicely as bookmarks. That was one of my initial alternative goals.
>>
>> SeaMonkey used to, natively, I think, do this!!
>>
>> Yes, Bookmarks->Manage Bookmarks then, in the Bookmark Manager,
>> Tools->Export HTML....
>
> That exists. But almost useless for my needs.
> It loses the hierarchical information. My bookmarks include both links
> and folders containing links. Nested several levels deep.

For whatever it's worth - in the 'Export HTML' file the hierarchy is
there, maybe not as nice as having
  "type":"text/x-moz-place-container"
  "type":"text/x-moz-place"
but it sure looks like one could keep track of the hierarchy:
  <DT><H3 ...>folder 1</H3>
  <DL><p>
    . . . .
  <DT><H3 ...>sub folder 1</H3>
  <DL><p>
   . . sub folder 1 contents. .
  </DL><p>
   . . . .
  <DT><H3 ...>sub folder 2</H3>
  <DL><p>
   . .  sub folder 2 contents . .
  </DL><p>
   . . remainder of folder 1 contents . .
  </DL><p>

>>> My path to that will depend on Linux tools. I suspect similar tools
>>> exist in Windows. I will be creating a description of my combination
>>> of scripts and manual edits.

How, or are, you handling de-duplicating bookmarks?  That's where I get stuck.
a bookmark here, the same bookmark there.. how does the program decide
which folder keeps the bookmark & which folder has the bookmark
removed?

Thanks,
Lee
0
Lee
8/18/2018 2:51:01 PM
<CC not needed. I am subscribed.>

On 08/18/2018 09:51 AM, Lee wrote:
> On 8/18/18, Richard Owlett <rowlett@cloud85.net> wrote:
>> On 08/18/2018 04:50 AM, Daniel wrote:
>>> Richard Owlett wrote on 18/08/2018 1:44 PM:
>>>> [snip]
>>>> Have made progress :]
>>>> BUT creating useful output in JSON format acceptable to SeaMonkey
>>>> unlikely :[
> 
>    Bookmarks / Manage Bookmarks
>    Tools / Restore / Choose / Choose File
> seems likely to work.  Or have you already tried that?

It works as advertised. It is just not designed to do things "my way" ;<
Up until almost the last step(s), my intermediate files will be valid 
JSON. HOWEVER most of the content SeaMonkey will expect have been purged 
as irrelevant to *MY* view/needs/desires/etc .}
You'll see why as I answer your other comments.

> 
>>>> HOWEVER I expect I'll be able to create a HTML file which can serve
>>>> nicely as bookmarks. That was one of my initial alternative goals.
>>>
>>> SeaMonkey used to, natively, I think, do this!!
>>>
>>> Yes, Bookmarks->Manage Bookmarks then, in the Bookmark Manager,
>>> Tools->Export HTML....
>>
>> That exists. But almost useless for my needs.
>> It loses the hierarchical information. My bookmarks include both links
>> and folders containing links. Nested several levels deep.
> 
> For whatever it's worth - in the 'Export HTML' file the hierarchy is
> there, maybe not as nice as having
>    "type":"text/x-moz-place-container"
>    "type":"text/x-moz-place"
> but it sure looks like one could keep track of the hierarchy:
>  [snip]

That was my first failed attempt. Personal problem? <chuckle>


>>>> My path to that will depend on Linux tools. I suspect similar tools
>>>> exist in Windows. I will be creating a description of my combination
>>>> of scripts and manual edits.
> 
> How, or are, you handling de-duplicating bookmarks?  That's where I get stuck.
> a bookmark here, the same bookmark there.. how does the program decide
> which folder keeps the bookmark & which folder has the bookmark
> removed?
> 

*AHAA* We come to crux of the issue. <*ROFL*>
{Note: I use a directory tree model of bookmarks folder.}

When de-duplicating bookmarks I impose a restriction that the desired 
bookmark is the one kept.

There is an important side issue. When pictured as a directory the 
folder hierarchy is {to be kind} chaos. As I noted in an earlier post: 
      > My bookmarks have grown like Topsy

It's beginning to look like the only needed will be jq and any BASIC.





0
Richard
8/18/2018 5:04:04 PM
Lee wrote:
> On 8/18/18, Richard Owlett <rowlett@cloud85.net> wrote:
>> On 08/18/2018 04:50 AM, Daniel wrote:
>>> Richard Owlett wrote on 18/08/2018 1:44 PM:
>>>> [snip]
>>>> Have made progress :]
>>>> BUT creating useful output in JSON format acceptable to SeaMonkey
>>>> unlikely :[
> 
>    Bookmarks / Manage Bookmarks
>    Tools / Restore / Choose / Choose File
> seems likely to work.  Or have you already tried that?
> 
>>>> HOWEVER I expect I'll be able to create a HTML file which can serve
>>>> nicely as bookmarks. That was one of my initial alternative goals.
>>>
>>> SeaMonkey used to, natively, I think, do this!!
*1 :/
>>>
>>> Yes, Bookmarks->Manage Bookmarks then, in the Bookmark Manager,
>>> Tools->Export HTML....
>>
>> That exists. But almost useless for my needs.
>> It loses the hierarchical information. My bookmarks include both links
>> and folders containing links. Nested several levels deep.
> 
> For whatever it's worth - in the 'Export HTML' file the hierarchy is
> there, maybe not as nice as having
>    "type":"text/x-moz-place-container"
>    "type":"text/x-moz-place"
> but it sure looks like one could keep track of the hierarchy:
>    <DT><H3 ...>folder 1</H3>
>    <DL><p>
>      . . . .
>    <DT><H3 ...>sub folder 1</H3>
>    <DL><p>
>     . . sub folder 1 contents. .
>    </DL><p>
>     . . . .
>    <DT><H3 ...>sub folder 2</H3>
>    <DL><p>
>     . .  sub folder 2 contents . .
>    </DL><p>
>     . . remainder of folder 1 contents . .
>    </DL><p>
> 
>>>> My path to that will depend on Linux tools. I suspect similar tools
>>>> exist in Windows. I will be creating a description of my combination
>>>> of scripts and manual edits.
> 
> How, or are, you handling de-duplicating bookmarks?  That's where I get stuck.
> a bookmark here, the same bookmark there.. how does the program decide
> which folder keeps the bookmark & which folder has the bookmark
> removed?
> 
> Thanks,
> Lee
> 


-- 
https://facebook.com/gerardjan.vinkesteijn
Karl's version of Parkinson's Law:  Work expands to exceed the time alloted it.
0
GerardJan
8/18/2018 7:58:48 PM
Richard Owlett wrote:
> 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
>
>
>
>
>
I have a limited understanding of programming and do not consider myself 
a programmer at all. Here is my question: "Would it be possible to 
create a plug in that would sort and locate duplicate bookmarks from 
within SeaMonkey rather than having to export the bookmarks and use an 
outside program?  Isn't there a way to automate advanced bookmark 
management using a plug in?"

0
Paul
8/19/2018 2:18:37 AM
Paul Bergsagel wrote on 19/08/2018 12:18 PM:
> Richard Owlett wrote:
>> 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
>>
> I have a limited understanding of programming and do not consider myself 
> a programmer at all. Here is my question: "Would it be possible to 
> create a plug in that would sort and locate duplicate bookmarks from 
> within SeaMonkey rather than having to export the bookmarks and use an 
> outside program?  Isn't there a way to automate advanced bookmark 
> management using a plug in?"
> 
I am fairly certain that there used to be an external program that would 
check a FireFox Bookmarks file looking for duplicates. And you could use 
it to sort out SeaMonkey (or was it Mozilla Suite) bookmarks as well.

But I think that was back in the days when Bookmarks were in a separate 
file (was it Bookmarks.html) rather than being part of the bigger, 
better, file that it now is.

-- 
Daniel

User agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 
SeaMonkey/2.49.1 Build identifier: 20171016030418

User agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 
SeaMonkey/2.49.1 Build identifier: 20171015235623
0
Daniel
8/19/2018 7:19:29 AM
Paul Bergsagel wrote:
> Richard Owlett wrote:
>> 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?

+1

>> 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
>>
>>
>>
>>
>>
> I have a limited understanding of programming and do not consider myself a 
> programmer at all. Here is my question: "Would it be possible to create a plug 
> in that would sort and locate duplicate bookmarks from within SeaMonkey rather 
> than having to export the bookmarks and use an outside program?  Isn't there a 
> way to automate advanced bookmark management using a plug in?"
> 


-- 
https://facebook.com/gerardjan.vinkesteijn
Karl's version of Parkinson's Law:  Work expands to exceed the time alloted it.
0
GerardJan
8/19/2018 8:07:34 AM
On 08/18/2018 09:18 PM, Paul Bergsagel wrote:
> Richard Owlett wrote:
>> My bookmarks have grown like Topsy
>> I have many duplicates and the tree structure is a mess.
>> I have two primary goals:
>> =C2=A0 1. find and purge duplicates.
>> =C2=A0 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 title=
d
>> "jq is sed for JSON".
>>
>> An outline of a possible procedure might be:
>> =C2=A01. Export SeaMonkey bookmarks in JSON format.
>> =C2=A02. use jq to pretty print the JSON. It does so nicely.
>> =C2=A03. Find duplicate targets and delete all but one.
>> =C2=A04. Each leaf of the bookmark tree is an object.
>> =C2=A0=C2=A0=C2=A0 Move these objects around to create a more friendly=
 tree.
>> =C2=A05. 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
>>
>>
> I have a limited understanding of programming and do not consider mysel=
f=20
> a programmer at all. Here is my question: "Would it be possible to=20
> create a plug in that would sort and locate duplicate bookmarks from=20
> within SeaMonkey rather than having to export the bookmarks and use an =

> outside program?=C2=A0 Isn't there a way to automate advanced bookmark =

> management using a plug in?"
>=20

I have philosophical and practical reasons.
Philosophically, I haven't used plugins since first using Netscape.
As to practical reasons:
   1. I don't know enough about SeaMonkey internals.
   2. I doubt I have the programming skills.
   3. This way has a better fit for some nominally unrelated projects.



0
Richard
8/19/2018 9:21:35 AM
On 8/19/18, Daniel <dxmm@rubbish.albury.net.au> wrote:
> Paul Bergsagel wrote on 19/08/2018 12:18 PM:
>> Richard Owlett wrote:
>>> 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
>>>
>> I have a limited understanding of programming and do not consider myself
>> a programmer at all. Here is my question: "Would it be possible to
>> create a plug in that would sort and locate duplicate bookmarks from
>> within SeaMonkey rather than having to export the bookmarks and use an
>> outside program?  Isn't there a way to automate advanced bookmark
>> management using a plug in?"

Most probably someone could write an addon to do that.  But aside from
needing someone to actually write it, Firefox is real close to
dropping support for ESR 52.x - which means all the old addons will no
longer work in any supported version of FF.

Since SM is based on FF ESR & I haven't seen anything about SM adding
support for the new FF webextensions yet, any addon written for SM
will probably work only until the next (next +1?) release.  So not
worth the effort (also see https://xkcd.com/1319/)


If you haven't seen this yet it's worth reading:
 http://www.downthemall.net/re-downthemall-and-webextensions-or-why-why-i-am-done-with-mozilla/

DTA was one of the most popular addons; I'm guessing that after much
begging the developer agreed to try and update his code to use the new
FF webextensions crapfest[1].  But check the home page:
    News
    (Lack of) Progress   December 21, 2017

DTA hasn't been converted to a web extension yet :(  And the addon
that does sortof work has issues:

https://addons.mozilla.org/en-US/firefox/addon/download-star/
  Note: The downloads API in web extensions is lacking in many
features. Currently, you can only place downloads inside of Firefox's
default downloads folder. Files served using Content-Disposition
header to provide a filename cannot be handled properly. Skip existing
files is based on remembering downloaded URLs, since there is no API
to test for existence of a file.

> I am fairly certain that there used to be an external program that would
> check a FireFox Bookmarks file looking for duplicates.

It's easy enough to write one:

$ cat ~/bin/findDupBookmarks.sh
#!/bin/sh
# input: FF/SM 'Export Bookmarks to HTML' file

BMF="$1"
# bookmark file name, should at least make sure it exists

grep '<A HREF=' ${BMF}              |\
 sed -e 's/^ *<DT><A HREF="//'       \
     -e 's/ ADD_DATE="[^"]*"//'      \
     -e 's/ LAST_MODIFIED="[^"]*"//' \
     -e 's/ LAST_CHARSET="[^"]*"//'  \
     -e 's/ TAGS="[^"]*"//'          \
     -e 's/">[^>]*>//'              |\
 sort | uniq -d

> But I think that was back in the days when Bookmarks were in a separate
> file (was it Bookmarks.html) rather than being part of the bigger,
> better, file that it now is.

open the bookmarks manager and select Tools / Export HTML

Regards,
Lee


[1] - yes, it is harsh.  But you don't remove the old system until the
replacement system is at least close to feature-parity w/ the old
without upsetting your users.
0
Lee
8/19/2018 5:59:14 PM
Lee wrote on 20/08/2018 3:59 AM:
> On 8/19/18, Daniel <dxmm@rubbish.albury.net.au> wrote:
>> Paul Bergsagel wrote on 19/08/2018 12:18 PM:
>>> Richard Owlett wrote:
>>>> 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
>>>> 
>>> I have a limited understanding of programming and do not consider
>>> myself a programmer at all. Here is my question: "Would it be
>>> possible to create a plug in that would sort and locate duplicate
>>> bookmarks from within SeaMonkey rather than having to export the
>>> bookmarks and use an outside program?  Isn't there a way to
>>> automate advanced bookmark management using a plug in?"
> 
> Most probably someone could write an addon to do that.  But aside
> from needing someone to actually write it, Firefox is real close to 
> dropping support for ESR 52.x - which means all the old addons will
> no longer work in any supported version of FF.

<Snip>

> open the bookmarks manager and select Tools / Export HTML

Yeap, did the exporting and ended with a bunch of gobble-de-gook!!
-- 
Daniel

User agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101
SeaMonkey/2.49.1 Build identifier: 20171016030418

User agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
SeaMonkey/2.49.1 Build identifier: 20171015235623
0
Daniel
8/20/2018 6:28:00 AM
On 08/20/2018 01:28 AM, Daniel wrote:
> Lee wrote on 20/08/2018 3:59 AM:
>> On 8/19/18, Daniel <dxmm@rubbish.albury.net.au> wrote:
> 
> <Snip>
> 
>> open the bookmarks manager and select Tools / Export HTML
> 
> Yeap, did the exporting and ended with a bunch of gobble-de-gook!!

I'm using SeaMonkey 2.49.1 {downloaded from the SeaMonkey site} on 
Debian Stretch. The exported HTML file looks fine when displayed by 
SeaMonkey.

It just does not preserve adequate nesting information for my purposes.



0
Richard
8/20/2018 11:03:26 AM
On 8/20/18, Daniel <dxmm@rubbish.albury.net.au> wrote:
> Lee wrote on 20/08/2018 3:59 AM:
>> On 8/19/18, Daniel <dxmm@rubbish.albury.net.au> wrote:
>>> Paul Bergsagel wrote on 19/08/2018 12:18 PM:
>>>> Richard Owlett wrote:
>>>>> 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
>>>>>
>>>> I have a limited understanding of programming and do not consider
>>>> myself a programmer at all. Here is my question: "Would it be
>>>> possible to create a plug in that would sort and locate duplicate
>>>> bookmarks from within SeaMonkey rather than having to export the
>>>> bookmarks and use an outside program?  Isn't there a way to
>>>> automate advanced bookmark management using a plug in?"
>>
>> Most probably someone could write an addon to do that.  But aside
>> from needing someone to actually write it, Firefox is real close to
>> dropping support for ESR 52.x - which means all the old addons will
>> no longer work in any supported version of FF.
>
> <Snip>
>
>> open the bookmarks manager and select Tools / Export HTML
>
> Yeap, did the exporting and ended with a bunch of gobble-de-gook!!

If you open the file with notepad.. yeah, it does look pretty horrible.
If you use something like notepad++ that automatically deals with
dos/unix line endings it looks much better :)

Lee
0
Lee
8/20/2018 6:59:27 PM
Richard Owlett wrote on 20/08/2018 9:03 PM:
> On 08/20/2018 01:28 AM, Daniel wrote:
>> Lee wrote on 20/08/2018 3:59 AM:
>>> On 8/19/18, Daniel <dxmm@rubbish.albury.net.au> wrote:
>>
>> <Snip>
>>
>>> open the bookmarks manager and select Tools / Export HTML
>>
>> Yeap, did the exporting and ended with a bunch of gobble-de-gook!!
> 
> I'm using SeaMonkey 2.49.1 {downloaded from the SeaMonkey site} on 
> Debian Stretch. The exported HTML file looks fine when displayed by 
> SeaMonkey.
> 
> It just does not preserve adequate nesting information for my purposes.
> 
and, as presented, I'm unable to edit it either! ;-(

-- 
Daniel

User agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 
SeaMonkey/2.49.1 Build identifier: 20171016030418

User agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 
SeaMonkey/2.49.1 Build identifier: 20171015235623
0
Daniel
8/21/2018 9:30:01 AM
Lee wrote on 21/08/2018 4:59 AM:
> On 8/20/18, Daniel <dxmm@rubbish.albury.net.au> wrote:
>> Lee wrote on 20/08/2018 3:59 AM:
>>> On 8/19/18, Daniel <dxmm@rubbish.albury.net.au> wrote:
>>>> Paul Bergsagel wrote on 19/08/2018 12:18 PM:
>>>>> Richard Owlett wrote:
>>>>>> 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
>>>>>>
>>>>> I have a limited understanding of programming and do not consider
>>>>> myself a programmer at all. Here is my question: "Would it be
>>>>> possible to create a plug in that would sort and locate duplicate
>>>>> bookmarks from within SeaMonkey rather than having to export the
>>>>> bookmarks and use an outside program?  Isn't there a way to
>>>>> automate advanced bookmark management using a plug in?"
>>>
>>> Most probably someone could write an addon to do that.  But aside
>>> from needing someone to actually write it, Firefox is real close to
>>> dropping support for ESR 52.x - which means all the old addons will
>>> no longer work in any supported version of FF.
>>
>> <Snip>
>>
>>> open the bookmarks manager and select Tools / Export HTML
>>
>> Yeap, did the exporting and ended with a bunch of gobble-de-gook!!
> 
> If you open the file with notepad.. yeah, it does look pretty horrible.
> If you use something like notepad++ that automatically deals with
> dos/unix line endings it looks much better :)
> 
> Lee
> 
Oh!! O.K., I'll have to try to locate a downloadable for notepad++. I 
wonder if wordpad might not be another possibility!!

-- 
Daniel

User agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 
SeaMonkey/2.49.1 Build identifier: 20171016030418

User agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 
SeaMonkey/2.49.1 Build identifier: 20171015235623
0
Daniel
8/21/2018 9:32:27 AM
Daniel wrote on 21/08/2018 7:32 PM:
> Lee wrote on 21/08/2018 4:59 AM:
>> On 8/20/18, Daniel <dxmm@rubbish.albury.net.au> wrote:
>>> Lee wrote on 20/08/2018 3:59 AM:
>>>> On 8/19/18, Daniel <dxmm@rubbish.albury.net.au> wrote:
>>>>> Paul Bergsagel wrote on 19/08/2018 12:18 PM:
>>>>>> Richard Owlett wrote:
>>>>>>> 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
>>>>>>>
>>>>>> I have a limited understanding of programming and do not consider
>>>>>> myself a programmer at all. Here is my question: "Would it be
>>>>>> possible to create a plug in that would sort and locate duplicate
>>>>>> bookmarks from within SeaMonkey rather than having to export the
>>>>>> bookmarks and use an outside program?  Isn't there a way to
>>>>>> automate advanced bookmark management using a plug in?"
>>>>
>>>> Most probably someone could write an addon to do that.  But aside
>>>> from needing someone to actually write it, Firefox is real close to
>>>> dropping support for ESR 52.x - which means all the old addons will
>>>> no longer work in any supported version of FF.
>>>
>>> <Snip>
>>>
>>>> open the bookmarks manager and select Tools / Export HTML
>>>
>>> Yeap, did the exporting and ended with a bunch of gobble-de-gook!!
>>
>> If you open the file with notepad.. yeah, it does look pretty horrible.
>> If you use something like notepad++ that automatically deals with
>> dos/unix line endings it looks much better :)
>>
>> Lee
>>
> Oh!! O.K., I'll have to try to locate a downloadable for notepad++. I 
> wonder if wordpad might not be another possibility!!
> 
Just tried with wordpad and the gobble-de-gook was still there.

Downloaded Notepad++ and installed it and it seemed to function well.

Now to see if I can have two instances of it running at the same time, 
both reading the same file, so I can compare two separate sections of 
that one file!! (Alternatively, I could save two copies of the Bookmarks 
file with different names!!)

-- 
Daniel

User agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 
SeaMonkey/2.49.1 Build identifier: 20171016030418

User agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 
SeaMonkey/2.49.1 Build identifier: 20171015235623
0
Daniel
8/21/2018 11:14:32 AM
On 8/21/18, Daniel <dxmm@rubbish.albury.net.au> wrote:
>>> If you open the file with notepad.. yeah, it does look pretty horrible.
>>> If you use something like notepad++ that automatically deals with
>>> dos/unix line endings it looks much better :)
>>>
>>> Lee
>>>
>> Oh!! O.K., I'll have to try to locate a downloadable for notepad++. I
>> wonder if wordpad might not be another possibility!!
>>
> Downloaded Notepad++ and installed it and it seemed to function well.
>
> Now to see if I can have two instances of it running at the same time,
> both reading the same file, so I can compare two separate sections of
> that one file!! (Alternatively, I could save two copies of the Bookmarks
> file with different names!!)

You could try the totally non-obvious
  View / Move/Clone Current Document / Clone to other view
in notepad++ or check out
  http://winmerge.org/
to see if that might be more suitable for what you're trying to do

Regards,
Lee
0
Lee
8/21/2018 9:59:54 PM
Lee wrote on 22/08/2018 7:59 AM:
> On 8/21/18, Daniel <dxmm@rubbish.albury.net.au> wrote:
>>>> If you open the file with notepad.. yeah, it does look pretty horrible.
>>>> If you use something like notepad++ that automatically deals with
>>>> dos/unix line endings it looks much better :)
>>>>
>>>> Lee
>>>>
>>> Oh!! O.K., I'll have to try to locate a downloadable for notepad++. I
>>> wonder if wordpad might not be another possibility!!
>>>
>> Downloaded Notepad++ and installed it and it seemed to function well.
>>
>> Now to see if I can have two instances of it running at the same time,
>> both reading the same file, so I can compare two separate sections of
>> that one file!! (Alternatively, I could save two copies of the Bookmarks
>> file with different names!!)
> 
> You could try the totally non-obvious
>    View / Move/Clone Current Document / Clone to other view
> in notepad++ or check out
>    http://winmerge.org/
> to see if that might be more suitable for what you're trying to do
> 
> Regards,
> Lee
> 
Something else to try, thank you, Lee. ;-)

-- 
Daniel

User agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 
SeaMonkey/2.49.1 Build identifier: 20171016030418

User agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 
SeaMonkey/2.49.1 Build identifier: 20171015235623
0
Daniel
8/22/2018 6:28:18 AM
Daniel wrote on 22/08/2018 4:28 PM:
> Lee wrote on 22/08/2018 7:59 AM:
>> On 8/21/18, Daniel <dxmm@rubbish.albury.net.au> wrote:
>>>>> If you open the file with notepad.. yeah, it does look pretty 
>>>>> horrible.
>>>>> If you use something like notepad++ that automatically deals with
>>>>> dos/unix line endings it looks much better :)
>>>>>
>>>>> Lee
>>>>>
>>>> Oh!! O.K., I'll have to try to locate a downloadable for notepad++. I
>>>> wonder if wordpad might not be another possibility!!
>>>>
>>> Downloaded Notepad++ and installed it and it seemed to function well.
>>>
>>> Now to see if I can have two instances of it running at the same time,
>>> both reading the same file, so I can compare two separate sections of
>>> that one file!! (Alternatively, I could save two copies of the Bookmarks
>>> file with different names!!)
>>
>> You could try the totally non-obvious
>>    View / Move/Clone Current Document / Clone to other view
>> in notepad++ or check out
>>    http://winmerge.org/
>> to see if that might be more suitable for what you're trying to do
>>
>> Regards,
>> Lee
>>
> Something else to try, thank you, Lee. ;-)
> 
At first glance, Lee, that appears to allow me to get two instances of 
the one file up ... but, it seems, I cannot then edit either instance in 
Notepad++ ... but I can do that in SM Bookmarks itself..

Thank you. ;-)

-- 
Daniel

User agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 
SeaMonkey/2.49.1 Build identifier: 20171016030418

User agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 
SeaMonkey/2.49.1 Build identifier: 20171015235623
0
Daniel
8/23/2018 4:20:56 AM
Daniel wrote:
> Daniel wrote on 22/08/2018 4:28 PM:
>> Lee wrote on 22/08/2018 7:59 AM:
>>> On 8/21/18, Daniel <dxmm@rubbish.albury.net.au> wrote:
>>>>>> If you open the file with notepad.. yeah, it does look pretty horrible.
>>>>>> If you use something like notepad++ that automatically deals with
>>>>>> dos/unix line endings it looks much better :)
>>>>>>
>>>>>> Lee
>>>>>>
>>>>> Oh!! O.K., I'll have to try to locate a downloadable for notepad++. I
>>>>> wonder if wordpad might not be another possibility!!
>>>>>
>>>> Downloaded Notepad++ and installed it and it seemed to function well.
>>>>
>>>> Now to see if I can have two instances of it running at the same time,
>>>> both reading the same file, so I can compare two separate sections of
>>>> that one file!! (Alternatively, I could save two copies of the Bookmarks
>>>> file with different names!!)
>>>
>>> You could try the totally non-obvious
>>>    View / Move/Clone Current Document / Clone to other view
>>> in notepad++ or check out
>>>    http://winmerge.org/
>>> to see if that might be more suitable for what you're trying to do
>>>
>>> Regards,
>>> Lee
>>>
>> Something else to try, thank you, Lee. ;-)
>>
> At first glance, Lee, that appears to allow me to get two instances of the one 
> file up ... but, it seems, I cannot then edit either instance in Notepad++ ... 
> but I can do that in SM Bookmarks itself..
> 
> Thank you. ;-)
> 

Dan!
You should upgrade to 2.49.3 !

-- 
https://facebook.com/gerardjan.vinkesteijn
Karl's version of Parkinson's Law:  Work expands to exceed the time alloted it.
0
GerardJan
8/23/2018 4:23:38 AM
On 08/18/2018 04:50 AM, Daniel wrote:
> Richard Owlett wrote on 18/08/2018 1:44 PM:
>>[snip]
>> Have made progress :]
>> BUT creating useful output in JSON format acceptable to SeaMonkey 
>> unlikely :[
> 
> Boo! Hiss!!

Sorry about that <snicker>
Have you looked at a JSON file even after pretty printing with "jq"?

> 
>> HOWEVER I expect I'll be able to create a HTML file which can serve 
>> nicely as bookmarks. That was one of my initial alternative goals.
> 
> SeaMonkey used to, natively, I think, do this!!
> 
> Yes, Bookmarks->Manage Bookmarks then, in the Bookmark Manager, 
> Tools->Export HTML....

Yes, *BUT*!!!!!
The way they chose to display the HTML hides much of the hierarchical 
stucture of nested bookmarks. Whether or not I delete a specific URL 
reference depends on where it is in the structure. I have some 
intentional duplications.


>> My path to that will depend on Linux tools. I suspect similar tools 
>> exist in Windows. I will be creating a description of my combination 
>> of scripts and manual edits.

I suspect that this could be done in jq with an expert's skill set.

My goals include:
   1. Create a HTML file with hierarchy *CLEARLY* visible.
   2. Create a text file of duplicated URLs and how many times
      each appears.
   3. Create a tool to ease removal of duplicates from *MY* HTML.
   4. I might possibly perhaps investigate creating an HTML file
      SeaMonkey could import. Enough qualifiers there??

My _preliminary_ TCL [not quite pre-alpha] is:
> # Input is SeaMonkey bookmark file pretty printed with "jq '.' ..."
> set infile  "pretty_json.txt"
> # the format of "useful.txt" not yet defined
> set outfile "useful.txt"
> set fd_in  [open $infile  r]
> set fd_out [open $outfile w]
> 
> set children   "\"child"
> set uri        "\"uri\":"
> set title      "\"title"
> set rbracket   \]
> set mylist [list $children  $uri  $title $rbracket]
> 
> while { ! [eof $fd_in] } {
>       gets $fd_in b_line 
>       set a_line [string trimleft $b_line]
>       set c_line [string range $a_line 0 5]  
> 
>       set x  [lsearch $mylist $c_line]
>       switch $x {
>           1 {procedure1}
>           2 {procedure2}
>           3 {procedure3}
>           4 {procedure4}
>           }
> }
> 
> close $fd_in
> close $fd_out
> 
0
Richard
8/25/2018 1:51:01 PM
Reply: