Filtering Chrome bookmark export (fucked up format) to make it grepable

Have you witnessed something about Chrome: it’s great to work with, it sucks to export from it.

Well, here is a simple example. If you export your bookmarks, you’ll be stuck with the following garbled output which cannot be nicely grepped for:

[...]
<DT><A HREF="https://github.com/robotframework/Rammbock" ADD_DATE="1353218622"
 ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACB
klEQVQ4jYVRPYsUQRB93TPTY+/OXH/MDeuCmAhmguGq6weGB6aCwQWG3g8QTMzMjeRQweACDUTxD4j
eIQYmgj/gEIXz3NuPg5ndWXtn2sDtY1w890XV1a9evaoiWEAURVeCILhFKb0Oa9sAAEL2qqp6a4x5n
mXZdp1ParGXSPnMD4L1RdE6ZsZs9Uej2wDKuoCntd4JPO/C/4odTFl+HAwGlwGUHgAkUm4Fvr9mjNn
OJ5Obo8PDPep5pwghvcravgWi3sHBvXw8vh8ydjbw/e4Jxs5MiuIVOOedVpraVppapdSmWwWARn01z
q1SatPxOecd2gjDDceaTqdP52EGYFwTyABYADDGvHDJRhhuUEJpFwBmZfmrqqr+svlns9luWVVTACC
UdikIcaf6URTF7jKBoii+WmB/XtOmzhoAAYAuEwBAYa2cx5Za4BsA+JQKKeWNZdVxHK/5nreCP52/U
2rtTmUt9nu9ElX1Mub80rHFnF8MGXvi3tbad2g2m+dFLCyAKYA+pdQSQsac844j+r5/jRDSc+ernf0
czfP8cxAGj1tpyiLgKud8fSWKPjHGfjoBxlgmhFituzFl+XA4HH45Smgp3ydaD5RSpwFI/I14NUly1
zlR6vU/Z0yS5FGi9SzRug+gXfs6eWRbiAfHrxiAEuKu1voDAO1yQgiVSPlGKXVnkf8bOtGzSzGU1hQ
AAAAASUVORK5CYII=">robotframework/Rammbock</A>
[...]
So grepping this means you'll get plenty of matches from the data encoding image for the ICON. Chrome, it sucks.

So after exporing bookmark,  you need to filter it first through some commands like:

sed 's/ICON=\"[0-9a-zA-Z\:\/\;\,\+\=\"]*//g' < ~/Documents/bookmarks_5_21_14.html  > ~/Documents/nbookmarks_5_21_14.html

Oh, but why grepping? well, bookmark search sucks so hard in Chrome (it can’t search on keywords in the URL for example), that you do need to do this to be able to get along.

Why not use XML tools? Well… is it standard? NO. sed and grep are.

About phil