View Single Post
Old 07-16-2015, 08:31 PM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,384
Karma: 27756918
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You dont actually need to parse JSON to get a list of ids from calibredb list, you can just do, for example:

Code:
calibredb list --search whatever -f title --separator , | cut -d, -f1 | tail -n +2 | awk -vORS=, '{ print $1 }' | sed 's/,$/\n/'
Or on windows, where none of the unix tools are available, you can just use calibre-debug

Code:
calibredb list --search whatever -f title  | calibre-debug -c "import sys; print ','.join(filter(None, [line.partition(' ')[0].strip() for line in sys.stdin][1:]))"
But, I realize this kind of thing is hard for most people, hence calibredb search
kovidgoyal is offline   Reply With Quote