-csv option with fmt file

Started by Thomas, January 27, 2014, 03:38:59 PM

Previous topic - Next topic

Thomas

Hi, Phil,

it seems to be so easy but I won't get it: When I export (using DOS shell of Windows) tag values from photo files to a csv file using the -csv and -p options with a fmt file, the result differs from what is presented in the answer to question 12 of the ExifTool FAQ. Using the given example

#[HEAD]FileName, Aperture, ISO
$filename, $aperture, $iso


as a fmt file yields

#[HEAD]FileName                         Aperture    ISO
20130928 175521=DSC01263.JPG   7.1            100#[HEAD]FileName    Aperture    ISO
20130928 175707=DSC01275.JPG   6.3            100#[HEAD]FileName    Aperture    ISO
20130928 180937=DSC01292.JPG   4               100#[HEAD]FileName    Aperture    ISO

I suppose this is rather a DOS/Unix topic than an ExifTool question. DOS seems to not to understand the meaning of the [HEAD] statement? Nonetheless I'm hoping for help... If there is another, i.e. more direct way to have columns in the csv file sorted, please let me know.

As I understand sourcefile is created by ExifTool itself. When exporting tag values I get emty values in the csv file (indicated by "-" with the -f option). Would you please tell me what to do here?

Thanks for any help!

Regards,
Thomas

Phil Harvey

Hi Thomas,

There appear to be some funny characters before the "[HEAD]" in your file.  Perhaps a UTF-8 BOM mark?  I suggest using a plain text editor to create this file.

Or maybe using the -csv option would be easier for you than -p.  This is the equivalent command:

exiftool -csv -filename -aperture -iso FILE

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Thomas

Hi, Phil,

thanks for your reply! The plain editor seems to be part of the solution. Therefore: no paste and copy anymore... However, the newlines separating the rows fillled with the file information also disappear:

FileName    Aperture    ISO            
20130928 175521=DSC01263.JPG   7.1    10020130928 175707=DSC01275.JPG   6.3    10020130928 180937=DSC01292.JPG   4    100SourceFile.

I found that #[TAIL] at the end of the fmt file brings them back. Call me a pedant: In every csv file I have created so far, there is the word "sourcefile" put in the last row of the file. How could I possibly get rid of it?

And two other questions: You have a hint for me about the empty values when exporting the sourcefile tag?
Which separator do you recommend to use for multiple keywords? Obviously, no commas as they are used to separate the entries in the csv file. Now, which separator between multiple keywords would be accepted by DigiKam or any other DAM software?

I like the fmt file approach as it allows to sort columns. Using exiftool -csv -filename -aperture -iso FILE will yield an order of columns according to tag groups, right?

Regards,
Thomas

Phil Harvey

Hi Thomas,

Quote from: Thomas on January 28, 2014, 05:45:28 PM
However, the newlines separating the rows fillled with the file information also disappear

It sounds like your file has the wrong type of newline characters.  I don't recall seeing that problem before.  I suggest trying a different editor.

Quotethere is the word "sourcefile" put in the last row of the file. How could I possibly get rid of it?

You can't with the -csv option.  If you need to do this, -p is the only alternative.

QuoteYou have a hint for me about the empty values when exporting the sourcefile tag?

I don't understand.  The SourceFile column should never be empty.

QuoteWhich separator do you recommend to use for multiple keywords?

If you use -csv, then a comma is fine since ExifTool will quote the value.   If you are using -p, then I would set the separator to a semicolon instead.

QuoteUsing exiftool -csv -filename -aperture -iso FILE will yield an order of columns according to tag groups, right?

No.  The columns are in the same order as you specify the tags.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Thomas

Hi, Phil,

thank you, your answers helped me a lot. This means that sourcefile exists only when using the -csv option but not the -p option?

Concerning sorting the columns: How does the G option alter the ordering when combined with the -csv option? I don't manage to get the same ordering in the csv file as on the commandline when using e.g. -G1 as an option. When using the -p option, G1 makes no difference as far as the ordering of columns is concerned, and the ordering in this case is consistent with the ordering of tag names on the commandline.

Regards,
Thomas

Phil Harvey

Hi Thomas,

Quote from: Thomas on January 29, 2014, 05:15:46 PM
This means that sourcefile exists only when using the -csv option but not the -p option?

Yes.  You should read about these options in the application documentation.

QuoteConcerning sorting the columns: How does the G option alter the ordering when combined with the -csv option?

If you specify the tag names, then the columns are in that order.  In this case, -G doesn't affect the order.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Thomas

Hi, Phil,

ok, thank your for all the support. I got it!

Regards,
Thomas