Extract all urls from the last firefox sessionstore.js file used.

2010-03-29 0 min read Linux
\"Effective
Image via Wikipedia

Some taken from commandlinefu. What all the below commands are doing is basically that the url: is captured from the sessionstore.js file and then just  extract the URL from the line. These are done in various ways using perl, <a class="zem_slink freebase/en/sed" title="Sed" rel="wikipedia" href="http://en.wikipedia.org/wiki/Sed">sed and <a class="zem_slink freebase/en/awk" title="AWK" rel="homepage" href="http://cm.bell-labs.com/cm/cs/awkbook/index.html">awk:

List last opened tabs in firefox browser

F=&#8221;$HOME/.moz*/fire*/*/session*.js&#8221; ; <a class="zem_slink freebase/en/grep" title="Grep" rel="wikipedia" href="http://en.wikipedia.org/wiki/Grep">grep -Go &#8217;entries:[[^]]*&#8217; $F | cut -d[ -f2 | while read A ; do echo $A | sed s/url:/n/g | tail -1 | cut -d&#8221; -f2; done

extract all urls from firefox sessionstore

sed -e &#8221;s/[{/n/g&#8221; -e &#8221;s/}, {/n/g&#8221;  sessionstore.js | grep url | awk -F&#8221;,&#8221; '{ print $1 }&#8217;| sed -e &#8221;s/url:&#8221;([^&#8221;]*)&#8221;/1/g&#8221; -e &#8221;/^about:blank/d&#8221;

Extract all urls from the last firefox sessionstore.js file used.

grep -oP &#8217;&#8221;url&#8221;:&#8221;K[^&#8221;]+&#8217; $(ls -t ~/.mozilla/firefox/*/sessionstore.js | sed q)

Extract all urls from last firefox sessionstore used in a portable way.

perl -lne &#8217;print for /url&#8221;:&#8221;K[^&#8221;]+/g&#8217; $(ls -t ~/.mozilla/firefox/*/sessionstore.js | sed q)

Extract all urls from the last firefox sessionstore.js file used.

sed -e &#8217;s/{&#8221;url&#8221;:/n&/g&#8217; ~/.mozilla/firefox/*/sessionstore.js | cut -d&#8221; -f4

<a href="http://feedads.g.doubleclick.net/~a/XACknx22B-yalEyu1-bsKYqdn3g/1/da"><img src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~a/XACknx22B-yalEyu1-bsKYqdn3g/1/di" alt="" align="bottom" /><h6 class="zemanta-related-title">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://hacks.mozilla.org/2009/12/file-drag-and-drop-in-firefox-3-6/">file drag and drop in Firefox 3.6 (hacks.mozilla.org) <li class="zemanta-article-ul-li"><a href="http://www.techcrunch.com/2009/12/13/google-phone-game/">Google Phone Get Its Own Holiday Game. Nexus One Users Only. (techcrunch.com) <li class="zemanta-article-ul-li"><a href="http://lifehacker.com/5427366/remains-of-the-day-dont-expect-great-iphone-service-friday-edition">Remains of the Day: Don&#8217;t Expect Great iPhone Service Friday Edition [For What It&#8217;s Worth] (lifehacker.com) <div class="zemanta-pixie"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/562c14c1-f6a8-4ab0-bc11-7edc99e79773/"><img class="zemanta-pixie-img" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/reblog_b32.png" alt="Reblog this post [with Zemanta]" /><span class="zem-script more-related more-info pretty-attribution paragraph-reblog">

comments powered by Disqus