Extracting edit summaries from Firefox (e.g., for Stack Overflow)

The short version: Past edit summaries used on Stack Overflow can be extracted from Firefox using a simple Linux (or Windows) command line with the SQL query “SELECT fieldname, value FROM moz_formhistory”:

sqlite3 formhistory.sqlite "SELECT fieldname, value FROM moz_formhistory" | grep 'edit-comment' | sort

The current directory must be where file formhistory.sqlite is. And SQLite 3 must be installed. And on Linux, Firefox must not be active on (using) that “profile” (there is usually only one profile by default); otherwise the result is “Error: database is locked”. A workaround for the former (to avoid having to quit Firefox) is to make a copy of file formhistory.sqlite and use the copy instead.

This can also be used when migrating to a new computer or to a new Firefox profile.

Finding formhistory.sqlite

In about:profiles, it is on the line “Root Directory” (for the profile in question). Press “Open Directory” to get a convenient way to copy/paste it.

Sample (Linux):

/home/mortensen/.mozilla/firefox/moi8yf2e.default

Command line

Windows

Installation of SQLite 3.

Sample command-line

cd C:\Users\someUser\AppData\Roaming\Mozilla\Firefox\Profiles\wy9qk6en.default
sqlite3 formhistory.sqlite "SELECT fieldname, value FROM moz_formhistory" | grep 'edit-comment'

Sample output

edit-comment|Removed meta information (this belongs in comments).
edit-comment|Copy edited (e.g. ref. <https://www.youtube.com/watch?v=1Dax90QyXgI&t=17m54s>). Dressed the naked link.
edit-comment|Removed the (rhetorical) question - it is not a real question (or at least not one we would answer on this site).
edit-comment|Removed the unrelated (rhetorical) question - it is not a real question (or at least not one we would answer on this site).
edit-comment|Active reading [<https://en.wikipedia.org/wiki/NetBeans> <https://en.wikipedia.org/wiki/Task_Manager_(Windows)> <https://en.wiktionary.org/wiki/can%27t#Verb>]. Jeopardy compliance.
edit-comment|Fixed the weird syntax highlighting (as a result, the diff looks more extensive than it really is - use view "Side-by-side Markdown" to compare).
edit-comment|Active reading [<https://en.wikipedia.org/wiki/NetBeans> - it is also the literal name of the folder].

Leave a Reply

Your email address will not be published. Required fields are marked *

*