How to manually modify a group of firefox history links, preferably by some text editor
2014-07
This question refers to FireFox v25 in my case.
A Wiki Workspace used by me, changed its name from
https://wikis.mycompany.com/teamcollab/wiki/MyProduct+Alpha+QA:Test+Automation
to
https://wikis.mycompany.com/teamcollab/wiki/MyProduct+QA:Test+Automation
omitting the word "Alpha" from the Wiki's name and URL.
I am frequently returning to pages on the wiki, by starting to write sections of the page's URL or Title in the address bar, which auto-suggests me relevant pages.
Now, this feature is broken, as all my pages are leading to the wrong URL and as a bonus, I now have duplicates of the new wiki and the old wiki in the history.
Since the History is saved in the
I want to be able to do the following (which is available for Bookmarks)
1) Export all the History I have 2) Manually go into the History and replace the URL and Title contents. 3) Import the new History.
or alternatively, what is a proper sqlite sql query to change the history.
I looked for a suitable Firefox add-on, but couldn't find one so far. This can also be a good option.
Thanks.
RaamEE
------IMPORTANT------
Save a copy of places.sqlite before you begin. Save 2 copies if needed. Use at your own discretion
------IMPORTANT------
I chose the dirtiest quickest solution. running 400 SQLite UPDATE commands to change 400 records.
1) copy a backup of places.sqlite from /Users/YourUserName/Library/Application Support/Firefox/Profiles/7skm4kzn.default/places.sqlite (MacOS system. The last directory differs between profiles) to places_bak.sqlite
2) run a HERE script to select the records and output into file
#!/bin/bash
sqlite3 places.sqlite << HERE > results.sql
select id, url from moz_places where url like '%MyProduct+Alpha+QA%';
HERE
3) Use vi and the next substitution to modify the urls (I didn't need to touch the Title)
:%s/\([0-9]*\)|\(.*\)MyProduct+Alpha+QA\(.*\)/UPDATE moz_places SET url='\2MyProduct+QA\3' WHERE id=\1;/gc
This will remove the word "+Alpha" from the URL and create a new set of UPDATE commands which in turn you can dump into the DB file using this HERE script
#!/bin/bash
sqlite3 places.sqlite << HERE
`cat results.sql`
HERE
4) Copy & Replace the original places.sqlite under your profile path. I suggest you shutdown firefox before overwriting the original file.
I want to remove large number of urls from my page history - they all match simple regexp, but there is a lot of them - doing this by "delete" in suggestion box is not an option. And when I bring history tab, whenever I click on item, it automatically opens - so I can't remove there anyway.
I heard that these urls are somewhere stored in sqllite format. Where exactly? Can I connect there and remove it from there (of course with Firefox not running)?
Seems you are right. In my Firefox profile directory, there is a filed named places.sqlite
. Opening it with sqlite reveals (amongst others) the tables moz_places
and moz_historyvisits
. It seems that moz_historyvisits
uses the primary of moz_places
to refer to the URLs.
I suggest you back up that file before you start deleting.
In Windows, You can do this from the Firefox history window (opens with CTRL H)
I presume that when you type "regexp" in the search pane, it shows all the entries you are interested in.
First
- Right click on the first entry to select that item then press escape.
- The selected item will remain selected, but not opened.
Then either
- Hit CTRL A to select all the items, or
- Hit Shift - DownArrow to select a subset of the selected entries
Then hit Delete
They are stored in the moz_places
table as full URL strings in the places.sqlite
database, which is found in these locations:
Windows XP
C:\Documents and Settings\[username]\Application Data\Mozilla\Firefox\Profiles\[profile folder]\places.sqlite
Windows Vista
C:\Users\[user]\AppData\Roaming\Mozilla\Firefox\Profiles\[profile folder]\places.sqlite
GNU/Linux
/home/[user]/.mozilla/firefox/[profile folder]/places.sqlite
Mac OS X
/Users/[user]/Library/Application Support/Firefox/Profiles/default.lov/places.sqlite
of course, [user] and [profile folder] will be different for your machine.