Search tool for EPUB e-books
Go to file
2021-08-20 18:58:23 +02:00
cmake Make sanitizers optional. 2021-08-20 18:54:27 +02:00
dist/termcolor Merge commit '6c33fb4dcebd5464d89ca3fb98bdf23847d81fbf' as 'dist/termcolor' 2021-05-25 10:43:32 +02:00
man Add sub-headings for option categories in man page. 2021-07-02 14:26:02 +02:00
src Don't crash if language detection fails. 2021-08-20 17:51:44 +02:00
tests Fix test, print exceptions. 2021-08-20 17:38:12 +02:00
translations Update german translation. 2021-08-20 17:07:12 +02:00
.clang-format Add .clang-tify and .clang-format. 2021-05-21 03:24:28 +02:00
.clang-tidy clang-tidy: Set cognitive complexity threshold to 30. 2021-06-29 02:09:40 +02:00
.drone.yml Compile with debug flags and sanitizers in CI. 2021-08-20 18:58:23 +02:00
.editorconfig Clean up .editorconfig. 2021-05-29 21:44:36 +02:00
.gitignore Ignore dap-mode file. 2021-06-22 17:23:26 +02:00
AUTHORS Initial commit. 2021-05-20 04:34:06 +02:00
CMakeLists.txt Make sanitizers optional. 2021-08-20 18:54:27 +02:00
CMakePresets.json Make sanitizers optional. 2021-08-20 18:54:27 +02:00
CODE_OF_CONDUCT.adoc Initial commit. 2021-05-20 04:34:06 +02:00
CONTRIBUTING.adoc Update rebuild-commands in translator guide. 2021-06-02 16:00:33 +02:00
CREDITS Update credits. 2021-06-01 18:49:34 +02:00
LICENSE Initial commit. 2021-05-20 04:34:06 +02:00
README.adoc Make sanitizers optional. 2021-08-20 18:54:27 +02:00
screenshot.png Update screenshot. 2021-06-02 10:04:27 +02:00

epubgrep

epubgrep is a search tool for EPUB e-books. It does not operate on lines, but on whole files. All newlines will be replaced by spaces and HTML will be stripped. This means you can search for text spanning multiple lines and dont have to worry about HTML tags in the text.

epubgrep is licensed under the AGPL-3.0-only. The bundled Termcolor is licensed under the BSD-3-Clause license.

Usage

Screenshot of epubgrep, showing the output of 2 book searches.

See man page for more information.

Install

Packaging status

Gentoo

sudo eselect repository enable guru
echo 'app-text/epubgrep' | sudo tee -a /etc/portage/package.accept_keywords/epubgrep
sudo emaint sync -r guru
sudo emerge -a app-text/epubgrep

Debian and Ubuntu

wget -O - https://tastytea.de/tastytea.asc | sudo apt-key add -
sudo add-apt-repository 'deb https://apt.schlomp.space/[code name] [code name] main'
sudo apt install epubgrep

Replace [code name] with the code name of your installation. Packages are available for bullseye (Debian 11), buster (Debian 10), focal (Ubuntu 20.04) and bionic (Ubuntu 18.04).

Tip
If you get the error message that add-apt-repository was not found, install software-properties-common.

From source

Dependencies

  • Tested OS: Linux

  • C++ compiler with C++17 support (tested: GCC 8/10, clang 6/11)

  • CMake (at least: 3.12)

  • Boost (tested: 1.75.0 / 1.65.0)

  • gettext (tested: 0.21 / 0.19)

  • libarchive (tested: 3.5 / 3.2)

  • fmt (tested: 7.0 / 4.0)

  • AsciiDoc (tested: 9.0 / 8.6)

  • Termcolor (tested: 2.0) (If not found, the bundled version is used.)

  • pugixml (tested: 1.11 / 1.8)

  • nlohmann_json (tested: 3.9 / 2.1)

  • Optional

    • Tests: Catch (tested: 2.13 / 1.10)

Install dependencies in Debian or Ubuntu

Or distributions that are derived from Debian or Ubuntu. You will need at least Debian buster (10) or Ubuntu focal (20.04).

sudo apt install build-essential cmake libboost-program-options-dev \
                 libboost-locale-dev libboost-regex-dev libboost-log-dev \
                 gettext libarchive-dev libfmt-dev asciidoc libpugixml-dev \
                 nlohmann-json-dev
Tip
If nlohmann-json-dev can not be found, try nlohmann-json3-dev.

Get sourcecode

Release

Download the current release at schlomp.space.

Development version
git clone https://schlomp.space/tastytea/epubgrep.git

Compile

In a terminal, go to the directory where you unpacked / cloned the source code and then:

cmake -S . -B build
cmake --build build --parallel $(nproc --ignore=1)

To install, run sudo cmake --install build. To run the tests, run ctest --test-dir build.

Tip
If you are using Debian or Ubuntu, or a distribution that is derived from these, you can run cpack -G DEB in the build directory to generate a .deb-file. You can then install it with apt install ./epubgrep-*.deb.
CMake options:
  • -DCMAKE_BUILD_TYPE=Debug for a debug build.

  • -DWITH_TESTS=YES if you want to compile the tests.

  • -DXGETTEXT_CMD=String The program to use instead of xgettext.

  • -DFALLBACK_BUNDLED=NO if you dont want to fall back on bundled libraries.

  • -DWITH_SANITIZER=YES to use sanitizers in debug builds.

Similar projects

  • ripgrep-all can search EPUB files and strips HTML, but does not display page numbers or headings.

  • zipgrep from unzip can search EPUB files but does not strip HTML and does not display page numbers or headings.