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

Linux

54 readers
2 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?

top 11 comments
sorted by: hot top controversial new old
[–] thagoat@lemmy.sdf.org 6 points 2 weeks ago (1 children)
[–] skaarl@feddit.nl 2 points 2 weeks ago (1 children)

This looks pretty cool, thanks!

[–] thagoat@lemmy.sdf.org 1 points 2 weeks ago (1 children)
[–] skaarl@feddit.nl 2 points 2 weeks ago

This tool is very powerful! Just what I needed, thanks again. Turns out you need pandoc 3+ and linux mint repo has 2.9, so after upgrading that rga started working, but it still throws this error from time to time:


parseSpine
Error: copying adapter output to stdout

Caused by:
    0: subprocess: Command { std: "pandoc" "--from=epub" "--to=plain" "--wrap=none" "--markdown-headings=atx", kill_on_drop: false }
    1: ExitStatus(unix_wait_status(16384))

I will have to keep looking into it, I'm not sure if this error stops the search in it's tracks.

[–] nesc@lemmy.cafe 4 points 2 weeks ago (1 children)

ls lists files, if you pipe it to grep it will print matching lines with file names. Universally you can't grep through ebook content, but you can do it with epub, probably other zipped text formats using zipgrep or just unzipthem and grep unarchived files.

[–] skaarl@feddit.nl 1 points 2 weeks ago
[–] hellfire103@lemmy.ca 3 points 2 weeks ago

Sounds like a good time to mention that "Little Brother" by Cory Doctorow is available in GNU Info format (usually used for manpages).

[–] ptz@dubvee.org 2 points 2 weeks ago* (last edited 2 weeks ago) (1 children)
[–] nesc@lemmy.cafe 2 points 2 weeks ago (1 children)

You can't grep zip archives directly.

[–] thagoat@lemmy.sdf.org 2 points 2 weeks ago (1 children)

Ripgrep-all has that capability.

[–] nesc@lemmy.cafe 3 points 2 weeks ago

Good to know.