[opensuse] Merging bookmark files
![](https://seccdn.libravatar.org/avatar/cabdbf4d350ab6a15265803acab1634d.jpg?s=120&d=mm&r=g)
*sigh* I have many generations of saved and backed up bookmark files that I would like to merge, preserving structure and correspondence. I've tried some plugins for Firefox and they are unsatisfactory. They don't 'merge' the just add, so there are many duplicates in the same folders and they have to be weeded out individually, step and repeat, with the program. Too much work! I google and find many written in perl or C that claim to do a sensible merge, but I see nothing to recommend one over another. Decisions paralysis and all that. In addition, the ones I see want HTML files whereas so many of the bookmark backups seem to be as JSON files. This is a particular stumbling point. It would be nice to be able to merge in files from Konqueror and other sources as well :-) Does anyone have recommendations ... And why? Thanks. -- /"\ \ / ASCII Ribbon Campaign X Against HTML Mail / \ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
![](https://seccdn.libravatar.org/avatar/9c06031aaadda145089b2480338feb86.jpg?s=120&d=mm&r=g)
Dne Po 22. prosince 2014 09:18:50, Anton Aylward napsal(a):
*sigh*
I have many generations of saved and backed up bookmark files that I would like to merge, preserving structure and correspondence.
I've tried some plugins for Firefox and they are unsatisfactory. They don't 'merge' the just add, so there are many duplicates in the same folders and they have to be weeded out individually, step and repeat, with the program. Too much work!
I google and find many written in perl or C that claim to do a sensible merge, but I see nothing to recommend one over another. Decisions paralysis and all that.
In addition, the ones I see want HTML files whereas so many of the bookmark backups seem to be as JSON files. This is a particular stumbling point.
It would be nice to be able to merge in files from Konqueror and other sources as well :-)
Does anyone have recommendations ... And why?
Thanks.
Well, this might be isn't exactly what You are looking for, but You can think about https://www.xmarks.com/ You have to trust the web service. And it doesn't have direct support for Konqueror, although You can upload a file there. I used to use it to share bookmarks among browsers and it worked fine. On the beginning id merged my bookmark sets and them kept them synced. It is just not good to combine it with other similar tools like Firefox sync. -- Vojtěch Zeisek Komunita openSUSE GNU/Linuxu Community of the openSUSE GNU/Linux http://www.opensuse.org/ http://trapa.cz/
![](https://seccdn.libravatar.org/avatar/d83d93d6ce9c9cccc5b4f6b437eddaa9.jpg?s=120&d=mm&r=g)
On Mon, 22 Dec 2014 09:18:50 -0500
Anton Aylward
*sigh*
I have many generations of saved and backed up bookmark files that I would like to merge, preserving structure and correspondence.
Maybe these old things could help a little? They will likely need some customisation for your schema but most of the hard work is done. I get myself into the same kind of situation from time to time and A bit of scripting to remove all what mozilla adds to urls in bookmarks, removes all the duplicates it can find then allows them all to be merged into a single file. Because manually editing mozilla boomarks can get quite tedious after the first few thousand or so. (needs to export bookmarks as html. won't work on json/xml. This was done just before mozilla started using json. Handling json & xml is a future project.) BTW, I haven't had time to run them lately. I expect there are some things that need to be done better and more that just needs doing. I created several working directories: incoming - holds the source bookmarks files grept - intermediate dir uniq - inermediate dir sorted - intermediate dir clean - final output Process a bunch of bookmark files in batch, in several steps with each intermediate file dropping into one of the above directories. A cleanup script removes the intermediate files. Or should. IIRC, I was removing them manually after making sure all went well. batchconvert.sh: ==BEGIN== #!/bin/bash # # # # INDIR=/home/mobile/bookmarks/unclean/ OUTDIR=/home/mobile/bookmarks/clean/ SCRIPTNAME=/home/mobile/bookmarks/sedscript.sed MAKEBACKUP=Y COMPRESSBACKUP=N RMORIGINAL=N LISTONLY=N cd $INDIR for i in *.html; do if [ $LISTONLY = Y ]; then echo $i fi if [ $LISTONLY = N ]; then # make a backup copy? if [ $MAKEBACKUP = Y ]; then cp $i /home/mobile/bookmarks/unclean-backups/$i fi # compress the backup? if [ $COMPRESSBACKUP = Y ] && [ $MAKEBACKUP = Y ]; then gzip /home/mobile/bookmarks/unclean-backups/$i fi # clean the file if test -f $INDIR/$i ;then sed -f /home/mobile/bookmarks/scripts/remove-from-bookmarks.sed $i > $OUTDIR/$i ERRESULT=$? echo $i " processed. Error == " $ERRRESULT fi # remove the original? if [ $RMORIGINAL = Y ]; then rm $i fi fi done ===END=== cleanup.sed: ==BEGIN== /^<!DOCTYPE NETSCAPE-Bookmark-file-1>/s/^<!DOCTYPE NETSCAPE-Bookmark-file-1>/<!-- Sanitized HTML by sed -->/g /^/ has been removed! -->/g /
/s/<\/p>//g /^<DL>/s/^<DL>//g /^<dl>/s/^<dl>//g /^<DT>/s/^<DT>//g /^<dt>/s/^<dt>//g /^<DD>/s/^<DD>.*$//g /^<dd>/s/^<dd>.*$//g /<\/DL>/s/<\/DL>//g /<\/dl>/s/<\/dl>//g /<\/DT>/s/<\/DT>//g /<\/dt>/s/<\/dt>//g / PERSONAL_TOOLBAR_FOLDER="/s/ PERSONAL_TOOLBAR_FOLDER=".*"//g / personal_toolbar_folder="/s/ personal_toolbar_folder=".*"//g / ADD_DATE="/s/ ADD_DATE=".*">/>/g / add_date="/s/ add_date=".*">/>/g / LAST_VISIT="/s/ LAST_VISIT=".*" //g / last_visit="/s/ last_visit=".*" //g / LAST_MODIFIED="/s/ LAST_MODIFIED=".*" //g / last_modified="/s/ last_modified=".*" //g / SHORTCUTURL="/s/ SHORTCUTURL=".*"//g / shortcuturl="/s/ shortcuturl=".*"//g / ICON="/s/ ICON=".*"//g / icon="/s/ icon=".*"//g / LAST_CHARSET="/s/ LAST_CHARSET=".*" //g / last_charset="/s/ last_charset=".*" //g / ID="rdf:/s/ ID="rdf:.*"//g / id="rdf:/s/ id="rdf:.*"//g /ID="rdf:/s/ID="rdf:.*"//g /id="rdf:/s/id="rdf:.*"//g /<BR>/s/<BR>//g /<br>/s/<br>//g /<\/A>/s/<\/A>/<\/A><BR>/g /" ">/s/" ">/">/g /^$/d ===END=== cleanup.sh: ==BEGIN== #!/bin/bash # # # # BASEDIR=/home/mobile/bookmarks INDIR=$BASEDIR/incoming GREPDIR=$BASEDIR/grept UNIQDIR=$BASEDIR/uniqt SORTDIR=$BASEDIR/sorted HEADDIR=$BASEDIR/headdir OUTDIR=$BASEDIR/clean SCRIPTDIR=$BASEDIR/scripts SCRIPTNAME=$SCRIPTDIR/cleanup.sed MAKEBACKUP=Y COMPRESSBACKUP=N RMORIGINAL=N LISTONLY=N #cd $BASEDIR grep -hi "A HREF=" $INDIR/* > $GREPDIR/grepped.out sort -f $GREPDIR/grepped.out > $SORTDIR/sorted.out uniq -i -u $SORTDIR/sorted.out > $UNIQDIR/uniq.out sed -f /home/mobile/bookmarks/scripts/cleanup.sed $UNIQDIR/uniq.out > $HEADDIR/out.out #cat $HEADDIR/heads.html > $OUTDIR/clean-bookmarks.html #cat $HEADDIR/out.out >> $OUTDIR/clean-bookmarks.html #cat $HEADDIR/tails.html >> $OUTDIR/clean-bookmarks.html ERRESULT=$? echo " processed. Error == " $ERRRESULT ===END=== -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (3)
-
Anton Aylward
-
jdebert
-
Vojtěch Zeisek