Is it possible to parse Chrome bookmarks with jq in one line? (for csv output)
With jq '.roots.other.children[]'
Bookmarks
I get separate lines
Is it possible to parse Chrome bookmarks with jq in one line? (for csv output)
With jq '.roots.other.children[]'
Bookmarks
I get separate lines
The Chrome bookmark format is not "flat" so it's not obvious what CSV output you want, but starting with .roots.other.children[] as you suggest, here's a start:
jq -r '.roots.other.children[]
| [.date_added,.id,.name,.sync_transaction_version,.type,.url,
(.meta_info|tostring)]
| @csv'
Notice how tostring
is used here to "flatten" .meta_info
. Notice also that the fields of interest have been specified explicitly -- this is to guard against the possibility that their ordering may not always be uniform within the bookmarks file.