View Single Post
Old 11-19-2024, 06:02 PM   #4
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,522
Karma: 8065528
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
I don't think calibredb can do it natively and I don't know how to do it in the windows cmd line. However, a simple python script can convert the output to a comma separated list.

To use it:
  • Put this script in some file such as newlines_to_commas.py
    Code:
    import sys
    ans = []
    for line in sys.stdin:
        ans.append(line.strip())
    print(','.join(ans[1:]))
  • Run your command storing the output into a file.
    Code:
    calibredb list -f id --with-library "C:\Users\Dirk\Calibre-Bibliothek" --search 'date:<10daysago' > file_with_newlines.txt
  • Run the script. If you don't have python installed then use calibre-debug as the python interpreter.
    Code:
    calibre-debug newlines_to_commas.py < file_with_newlines.txt > file_without_newlines.txt
    If you have python installed then use
    Code:
    python newlines_to_commas.py < file_with_newlines.txt > file_without_newlines.txt
  • The comma-separated list is now in file_without_newlines.txt

Last edited by chaley; 11-20-2024 at 03:54 AM. Reason: fix file name in last line
chaley is offline   Reply With Quote