Parsing Firefox history.dat file?

Eric "Shubes" plug at shubes.net
Mon Dec 31 15:42:45 MST 2007


Alan Dayley wrote:
> I want to parse or convert to text the Firefox history.dat file.  There
> is apparently a Windows application called Dork that does it.  But I'm
> not on Windows.  :^)
> 
> All I want to do is extract a list of the URLs.  I'm wading through
> Google search results but it is probably faster to ask the group.
> 
> Alan
> 

Nice little exercise. I'm sure there are a myriad of ways to do this.

This is what I came up with (from directory containing history.dat):
$ tr -d '\\\n' <history.dat | tr ')' '\n' | grep =http:// | cut -d = -f 2-
>history.urls

It basically does this:
1) strips out all backslashes and newlines
2) replaces all close-parentheses with newlines
3) selects all lines containing =http:
4) cuts off the front of each line up through the first '='

When I run it, what appears to be in the history.url file is nothing but
urls. How's it work for you?

-- 
-Eric 'shubes'


More information about the PLUG-discuss mailing list