View Single Post
Old 03-26-2022, 11:28 AM   #4
salamanderjuice
Guru
salamanderjuice ought to be getting tired of karma fortunes by now.salamanderjuice ought to be getting tired of karma fortunes by now.salamanderjuice ought to be getting tired of karma fortunes by now.salamanderjuice ought to be getting tired of karma fortunes by now.salamanderjuice ought to be getting tired of karma fortunes by now.salamanderjuice ought to be getting tired of karma fortunes by now.salamanderjuice ought to be getting tired of karma fortunes by now.salamanderjuice ought to be getting tired of karma fortunes by now.salamanderjuice ought to be getting tired of karma fortunes by now.salamanderjuice ought to be getting tired of karma fortunes by now.salamanderjuice ought to be getting tired of karma fortunes by now.
 
Posts: 948
Karma: 13014268
Join Date: Jul 2017
Device: Boox Nova 2
Did you have a look at the Power Search plugin for Calibre that allows for searching the contents of files? That might do what you want.

You could also do this somewhat easily with shell commands and scripting in the terminal although how you do it depends on exactly what kinds of files you are searching and what kinds of content and how you have it organized. For example on my Ubuntu machine I can get a list of all my epubs in my Calibre library containing the word "goose" using

Code:
 find . -name "*.epub" -exec ../mysearch.sh "goose" {} \;
The find command finds all the .epub files within the current folder (that's the "." after find) and then on each of those file names it runs the mysearch script that I put one folder up with arguments "goose" (what I'm searching for) and {} which represents the current file path from find and then \; tells it there's no more arguments.

mysearch.sh is just a simple wrapper around the utility "zipgrep" which searches inside zip files which epubs are. This is needed because otherwise it won't report the epub file name but the name of the file in the epub which isn't helpful so the wrapper returns the file name if there has been a match.

mysearch.sh:
Code:
#!/bin/bash

zipgrep "$1" "$2"
if [ $? -eq 0 ]; then
    echo "$2"
fi
It's not quick I'll admit though. And the above may not work on Mac since they have some command differences.
salamanderjuice is offline   Reply With Quote