Writing extraction results to files
Surf offers various ways for you to write extraction results to a file (or files) so you can process the results in other commands and tools.
Writing all results to a single file
The --output-file
(or -o
) parameter writes all results to a single file, in whatever output format is selected (usually csv
or json
).
For example, the following command writes the results in csv
format to results.csv
:
surf extract myextractor *.pdf -f csv -o results.csv
Note that any existing file with the same name will be overwritten.
An alternative way of achieving the same thing is to redirect stdout, like this (on Windows):
surf extract myextractor *.pdf -f csv > results.csv
Writing results for each input file to a separate results file
The --multiple-files
(or -m
) parameter writes results for each input file into a separate results file in the same directory, with the same name but different file extension. The extension is determined from the output format being used.
For example, let's say we have these two files in a directory:
- 0001.tif
- 0002.tif
Using the -m
option with the csv
output format will create the following results files in the same directory:
-
0001.csv
-
0002.csv
0001.csv will contain only the results for 0001.tif and so on.
To create individual results files, simply add the -m
parameter. Normally you'll also want to specify csv
or json
format when using this parameter, like this:
surf extract myextractor *.pdf -f csv -m
Note that any existing files with the same names as the results files will be overwritten.
Displaying progress information
If you are processing multiple files and writing results to a file (or files) using the
-m
or-o
parameters, you can display a progress bar using the-p
parameter. This will show you how many files have been processed and how many are still pending.
Updated over 3 years ago