Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

is there a way possible with terminal pipelining to sort the bookmarks Mozilla Firefoxstores in alphabetical order?

I tried dabbing a little but to my disappointment ,the bookmarks are stored in JSON format ,how do you extract things from that ?

share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

If you state what your final goal is, you will get better answers. You can get a somewhat clean list of sorted URLs from a JSON file with something like:

sed 's/,/\n/g' bookmarks-2012-07-07.json | grep '"uri"' | grep http | cut -d '"' -f 4 | sort

Your most powerful option is to utilize sqlite3 to get the bookmarks from the file places.sqlite from your home directory.

share|improve this answer
    
wow ,is that the regex power coming into picture or am i missing something ? –  borax12 Jul 8 '12 at 8:14
    
Assume his computer with Firefox only boots up in console mode now, no GUI. But he still wants to sort his bookmarks alphabetically with what he has. There you have it ;) –  izx Jul 8 '12 at 8:18
    
i know it will be too much to ask but can you just explain how does that work out ? –  borax12 Jul 8 '12 at 8:19
    
sed is a powerful stream editor, used above only to substitute one string with another. You can utilize regex with sed, but the example given doesn't do that much (even though a single character typically does qualify as a REGEX). –  Marios Zindilis Jul 8 '12 at 8:21
add comment

If you simply want to sort the bookmarks in Firefox alphabetically, it's very easy to do and no command-line magic is necessary.

  1. Press Ctrl+Shift+O (<--letter O) to open the Bookmarks Library.
  2. Navigate to the folder you want to sort, right-click on it and click on "Sort by Name":

    enter image description here

  3. Those bookmarks will be sorted alphabetically. Notice the before/after difference:

    enter image description here

share|improve this answer
    
Well thats not what i wanted izk ,but thanks anyways ,i wanted to do it via terminal –  borax12 Jul 8 '12 at 8:13
    
OK, fixed the title for you. –  izx Jul 8 '12 at 8:17
    
thanks izk ,that was prompt –  borax12 Jul 8 '12 at 8:19
    
Note that the backups are in json, the actual bookmarks are stored in places.sqlite as Marios explained in his answer. –  izx Jul 8 '12 at 8:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.