this post was submitted on 12 Feb 2025
12 points (100.0% liked)

Linux

2181 readers
26 users here now

founded 2 years ago
MODERATORS
 

I was trying to do that but I noticed ls | grep searchterm just searches the book TITLES for searchterm. Is this possible, to search the text of ebooks?

you are viewing a single comment's thread
view the rest of the comments
[–] sylver_dragon 3 points 12 hours ago

It's going to be different for different file formats. For example, something like epub is going to be hard because the format is really just a zip file with a specific internal file structure. So, it's not really the .epub file you want to grep, but one of the files within that zip file you want to grep through. EBooks stored as PDFs could be a bit easier, as they are a monolithic file format with text often (though not always) stored just as plain text. However, the text streams can be encrypted and/or compressed (FlateDecode); so, there is no guarantee of seeing plain text.

I'm sure there are more formats, but I think you get the idea, how you would do a string search comes down to the actual file format. And some are not going to be easily greppable. It's not impossible, just not straight forward.