Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 11-19-2024, 03:10 PM   #1
MasterPlexus
Enthusiast
MasterPlexus began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Nov 2024
Device: Tolino 4HD
calibre db result with comma separated id's

Hi,

I try to bring
Code:
calibredb list -f id --with-library "C:\Users\Dirk\Calibre-Bibliothek" --search 'date:<10daysago'
that it results in a comma separated list. As I'm under windows I'm not able to use
Code:
| cut -f1 -d" " | tail -n+2
what I have seen in other threads. --separator is only separating if you have a list of fields, but not making a linefeed but a Comma seems to be not possible directly?

May some has an idea.
Thanks
MP
MasterPlexus is offline   Reply With Quote
Old 11-19-2024, 04:03 PM   #2
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,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
When I do the following in a windows cmd box:
Code:
calibredb list -f id --search "date:<10daysago"
I get a newline-separated list of ids.

Example output:
Code:
id
50
208
209
1059
1060
1062
What exactly are you getting?

If you are trying to get rid of the first line (id) then see the solutions in this post.

What version of calibre are you running?
chaley is offline   Reply With Quote
Advert
Old 11-19-2024, 04:21 PM   #3
MasterPlexus
Enthusiast
MasterPlexus began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Nov 2024
Device: Tolino 4HD
Hi.
I geht the same result. But i want to geht Pike
50, 208,209..... So instead oft newline a comma.

Version 7.21 is here in use.
BR
MP
MasterPlexus is offline   Reply With Quote
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,447
Karma: 8012886
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
Old 11-20-2024, 12:38 AM   #5
MasterPlexus
Enthusiast
MasterPlexus began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Nov 2024
Device: Tolino 4HD
Many thanks, very helpfull!
MasterPlexus is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Escaping Comma in Custom Comma Separated Text Column Kelpman Library Management 2 12-07-2023 10:58 AM
Search and Repace in comma separated list Hortensia Library Management 2 10-20-2021 05:47 PM
Custom column - Comma separated text MerlinMama Library Management 4 09-17-2015 02:34 PM
Multiple comma separated values in custom column? silentguy Library Management 8 04-19-2011 05:10 AM
Switching author name from comma separated to first last kbaggs Library Management 1 01-30-2011 03:36 PM


All times are GMT -4. The time now is 02:30 PM.


MobileRead.com is a privately owned, operated and funded community.