Example output of ebook-meta unixpowertools.epub
:
Title : UNIX Power Tools, 3rd Edition
Author(s) : Jerry Peek, Shelley Powers, Tim O’Reilly & Mike Loukides [Jerry Peek, Shelley Powers, Tim O’Reilly, and Mike Loukides]
Publisher : O’Reilly Media
Tags : COMPUTERS / Operating Systems / UNIX
Languages : eng
Published : 2009-02-08T23:00:00+00:00
Rights : Copyright © 2009 O’Reilly Media, Inc.
Identifiers : isbn:9780596103699
Comments : <p>The latest edition of this best-selling favorite is loaded with vital information on Linux, Darwin, and BSD. <i>Unix Power Tools</i> 3rd Edition now offers more coverage of bash, zsh, and other new shells, along with discussions about modern utilities and applications. Several sections focus on security and Internet access. There is a new chapter on access to Unix from Windows, and expanded coverage of software installation and packaging, as well as basic information on Perl and Python.</p>
We can use grep
, cut
, and sed
to get at the title:
ebook-meta unixpowertools.epub | grep '^Title \+:' | cut -d: -f2- | sed 's/^ //'
This produces
UNIX Power Tools, 3rd Edition
for the example file above.
Explanation of the command
grep
ebook-meta unixpowertools.epub | grep '^Title \+:'
Print the line that starts with "Title" followed by one or more spaces, followed by a colon. This matches
Title : UNIX Power Tools, 3rd Edition
but not
Title sort : UNIX Power Tools, 3rd Edition
which ebook-meta
also prints for some ebooks.
cut and sed
With cut -d:
we split up the "Title" line by colons. -f2-
means we print everything after the first colon. The output of our cut
command is now " UNIX Power Tools, 3rd Edition".
We delete the leading space with sed 's/^ //'
.
As a side note: This command also works if the ebook title contains a colon, as in
UNIX Power Tools: 3rd Edition
Supported ebook formats
Regarding the supported file formats, I quote from the manual:
Supported formats for reading metadata: azw, azw1, azw3, azw4, cbr, cbz, chm, docx, epub, fb2, fbz, html, htmlz, imp, lit, lrf, lrx, mobi, odt, oebzip, opf, pdb, pdf, pml, pmlz, pobi, prc, rar, rb, rtf, snb, tpz, txt, txtz, updb, zip
Supported formats for writing metadata: azw, azw1, azw3, azw4, docx, epub, fb2, fbz, htmlz, lrf, mobi, odt, pdb, pdf, prc, rtf, tpz, txtz