extract.1 (7946B)
1 .TH EXTRACT 1 "Nov 1, 2026" "libextractor 1.19" 2 .\" $Id 3 .SH NAME 4 extract 5 \- determine meta-information about a file 6 .SH SYNOPSIS 7 .B extract 8 [ 9 .B \-bgihLmnvV 10 ] 11 [ 12 .B \-l 13 .I library 14 ] 15 [ 16 .B \-p 17 .I type 18 ] 19 [ 20 .B \-x 21 .I type 22 ] 23 .I file 24 \&... 25 .br 26 .SH DESCRIPTION 27 This manual page documents version 1.19 of the 28 .B extract 29 command. 30 .PP 31 .B extract 32 tests each file specified in the argument list in an attempt to infer meta\-information from it. Each file is subjected to the meta\-data extraction libraries from 33 .I libextractor. 34 .PP 35 libextractor classifies meta\-information (also referred to as keywords) into types. A list of all types can be obtained with the 36 .B \-L 37 option. 38 39 .SH OPTIONS 40 .TP 8 41 .B \-b 42 Display the output in BiBTeX format. 43 .TP 8 44 .B \-g 45 Use grep\-friendly output (all keywords on a single line for each file). Use the verbose option to print the filename first, followed by the keywords. Use the verbose option twice to also display the keyword types. This option will not print keyword types or non\-textual metadata. Note that it cannot keep the one\-line promise for keywords that contain newlines themselves, such as the full text (see 46 .B "PLUGIN OPTIONS" 47 below). 48 .TP 8 49 .B \-h 50 Print a brief summary of the options. 51 .TP 8 52 .B \-i 53 Run plugins in\-process (for debugging). By default, each plugin is run in its own process. 54 .TP 8 55 .BI \-l " libraries" 56 Use the specified plugins to extract keywords. 57 .I libraries 58 is a colon\-separated list of entries of the form 59 .RI [ \- ] name [ ( options ) ] 60 where 61 .I name 62 is the short name of a libextractor plugin, for example 63 .BR pdf , 64 .B html 65 or 66 .B odf 67 for the plugins installed as 68 .IR libextractor_pdf.so , 69 .I libextractor_html.so 70 and 71 .IR libextractor_odf.so . 72 Neither the 73 .B libextractor_ 74 prefix nor the 75 .B .so 76 suffix is part of the name. 77 A leading minus sign removes a plugin from the list built so far instead of adding it. 78 .I options 79 is a comma\-separated plugin configuration string; see 80 .B "PLUGIN OPTIONS" 81 below. 82 .IP 83 Only the 84 .I last 85 .B \-l 86 option on the command line is used, so several plugins have to be 87 named in a single colon\-separated list. Adding a plugin that is 88 already in the list has no effect; in particular it does 89 .I not 90 change the options of the plugin that is already there. To pass 91 options to a plugin that the default set already provides, either drop 92 the default set with 93 .B \-n 94 or remove the plugin before adding it again, as in 95 .BR \-l\ \(dq\-pdf:pdf(fulltext)\(dq . 96 To run only a few selected plugins, use 97 .B \-l 98 in combination with 99 .BR \-n . 100 .TP 8 101 .B \-L 102 Print a list of all known keyword types. 103 .TP 8 104 .B \-m 105 Load the file into memory and perform extraction from memory (for debugging). 106 .TP 8 107 .B \-n 108 Do not use the default set of extractors (typically all standard extractors, currently mp3, ogg, jpg, gif, png, tiff, real, html, pdf and mime\-types), use only the extractors specified with the 109 .B \-l 110 option. 111 .TP 8 112 .BI \-p " type" 113 Print only the keywords matching the specified type. By default, all keywords that are found and not removed as duplicates are printed. 114 .TP 8 115 .B \-v 116 Print the version number and exit. 117 .TP 8 118 .B \-V 119 Be verbose. This option can be specified multiple times to increase verbosity further. 120 .TP 8 121 .BI \-x " type" 122 Exclude keywords of the specified type from the output. By default, all keywords that are found and not removed as duplicates are printed. 123 124 .SH "PLUGIN OPTIONS" 125 A plugin can be given a configuration string by appending it in 126 parentheses to the plugin name in the argument of 127 .BR \-l , 128 as in 129 .BR \-l\ \(dqpdf(fulltext)\(dq . 130 The string is a comma\-separated list of tokens; which tokens are 131 understood is up to the individual plugin, and a plugin silently 132 ignores an option it does not know. The parentheses are special to 133 the shell, so the argument of 134 .B \-l 135 normally has to be quoted. 136 .PP 137 The options of the thumbnail plugins 138 .RB ( size , 139 .BR format , 140 .BR srt 141 and 142 .BR gallery ) 143 are described in the Texinfo manual. The option understood by the 144 largest number of plugins is 145 .BR fulltext . 146 .SS "Full text" 147 The 148 .BR html , 149 .BR pdf , 150 .BR ebook , 151 .BR odf , 152 .B ole2 153 and 154 .B dvi 155 plugins can report the entire text of a document as a single keyword 156 of type 157 .B "full text" 158 .RB ( EXTRACTOR_METATYPE_FULL_TEXT , 159 UTF\-8, MIME type 160 .BR text/plain ). 161 As that text can be large, it is only reported if the plugin is given 162 the option 163 .BR fulltext . 164 .PP 165 Within a paragraph, runs of whitespace \(em including the line breaks 166 of the input \(em are reported as a single space; paragraphs are 167 separated by exactly two newlines. Where the format makes it 168 possible, text that is not part of the running text is left out: page 169 numbers, running headers and footers, navigation bars and the like. 170 The text is truncated at 16 MiB. 171 .PP 172 To extract the text of a document, drop the default plugins with 173 .B \-n 174 and name just the plugin for that format: 175 .PP 176 .RS 177 .nf 178 $ cat article.html 179 <html> 180 <head><title>On Cheese</title> 181 <meta name="author" content="Christian Grothoff"></head> 182 <body> 183 <nav><a href="/">Home</a> | <a href="/up">Up</a></nav> 184 <h1>On Cheese</h1> 185 <p>The first paragraph is written 186 over three 187 source lines.</p> 188 <p>The second paragraph follows.</p> 189 </body> 190 </html> 191 192 $ extract \-n \-l "html(fulltext)" article.html 193 Keywords for file article.html: 194 title \- On Cheese 195 author name \- Christian Grothoff 196 full text \- On Cheese 197 198 The first paragraph is written over three source lines. 199 200 The second paragraph follows. 201 .fi 202 .RE 203 .PP 204 The navigation bar was dropped, the line breaks inside the first 205 paragraph became single spaces, and the break between the two 206 paragraphs was kept. 207 .PP 208 Use 209 .B \-p 210 to print nothing but the text, which is what a full\-text indexer 211 wants: 212 .PP 213 .RS 214 .nf 215 $ extract \-n \-l "pdf(fulltext)" \-p "full text" book.pdf 216 Keywords for file book.pdf: 217 full text \- Chapter One 218 219 It was a dark and stormy night [...] 220 .fi 221 .RE 222 .PP 223 Conversely, 224 .B \-x 225 keeps the ordinary meta data and suppresses the text: 226 .PP 227 .RS 228 .nf 229 $ extract \-n \-l "pdf(fulltext)" \-x "full text" book.pdf 230 Keywords for file book.pdf: 231 mimetype \- application/pdf 232 title \- Paul Clifford 233 author name \- Edward Bulwer\-Lytton 234 page count \- 384 235 .fi 236 .RE 237 .PP 238 Several plugins can be configured in one list, so that a directory of 239 mixed documents can be handled in a single run: 240 .PP 241 .RS 242 .nf 243 $ extract \-n \-l "pdf(fulltext):odf(fulltext):html(fulltext)" \e 244 \-p "full text" * 245 .fi 246 .RE 247 .PP 248 If the remaining meta data of the default plugin set is wanted as 249 well, remove the plugin from that set before adding it back with the 250 option; adding it a second time would have no effect: 251 .PP 252 .RS 253 .nf 254 $ extract \-l "\-pdf:pdf(fulltext)" book.pdf 255 .fi 256 .RE 257 .SH "SEE ALSO" 258 .BR libextractor (3) 259 \- description of the libextractor library 260 .br 261 .SH EXAMPLES 262 The sample files used below are those of the test suite, in 263 .IR src/plugins/testdata/ . 264 .PP 265 .nf 266 $ extract \-n \-l jpeg jpeg_image.jpg 267 Keywords for file jpeg_image.jpg: 268 mimetype \- image/jpeg 269 image dimensions \- 3x3 270 comment \- (C) 2001 by Christian Grothoff, using gimp 1.2 1 271 272 $ extract \-n \-l jpeg \-x comment jpeg_image.jpg 273 Keywords for file jpeg_image.jpg: 274 mimetype \- image/jpeg 275 image dimensions \- 3x3 276 277 $ extract \-n \-l jpeg \-p comment jpeg_image.jpg 278 Keywords for file jpeg_image.jpg: 279 comment \- (C) 2001 by Christian Grothoff, using gimp 1.2 1 280 281 $ extract \-n \-l gif \-p comment jpeg_image.jpg gif_image.gif 282 Keywords for file jpeg_image.jpg: 283 Keywords for file gif_image.gif: 284 comment \- Testing keyword extraction 285 .fi 286 287 .SH "LEGAL NOTICE" 288 libextractor and the extract tool are released under the GPL. libextractor is a GNU package. 289 290 .SH BUGS 291 A couple of file\-formats (on the order of 10^3) are not recognized... 292 293 .SH AUTHORS 294 .B extract 295 was originally written by Christian Grothoff <christian@grothoff.org> and Vidyut Samanta <vids@cs.ucla.edu>. Use <libextractor@gnu.org> to contact the current maintainer(s). 296 297 .SH AVAILABILITY 298 You can obtain the original author's latest version from http://www.gnu.org/software/libextractor/