[Markdown] 

Linux hints: firefox awk script (about:config to user.js)

awk script for converting exported as plain text firefox “about:config” settings to “user.js” file which can be put into profile directory for auto import into settings

{
    gsub("\"", "\\\"", $2);
    if(!index($2, ".") && !index($2, "-"))
    {
       if ($2 == "true" || $2 == "false" || typeof($2) == "number" || typeof($2) == "strnum")
            printf "user_pref(\"%s\", %s);\n", $1, $2
        else
            printf "user_pref(\"%s\", \"%s\");\n", $1, $2
    }
    else
        printf "user_pref(\"%s\", \"%s\");\n", $1, $2
}
  • how to use
  1. in firefox got to about:config
  2. if settings hidden, press show all
  3. press "Ctrl + s" and save file somewhere
  4. execute this script like: awk -f ./exported_about_config_plaintext_to_user_js.awk ff_prefs > user.js