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 /