ExifTool Forum

ExifTool => Developers => Topic started by: inanealex on October 26, 2012, 10:13:00 AM

Title: How to replace the hyphen for an empty tag with something else?
Post by: inanealex on October 26, 2012, 10:13:00 AM
I am using exiftool -T -@ MD_G_Lookup.txt -@ MD_G_Folders.txt to return a string containing data for the metadata tags listed in the first argfile for every file listed in the second argfile. Works great, adding a hyphen for every flag that doesn't have any data. The list of returned metadata has the same number of items for each file, helping me parse it into fields of a database.

I've worked out a solution in my database to tell the difference between a single hyphen being written (for no data being read by the search) and a longer string that may contain a hyphen. I'm sure I could figure out a shell that would do the same (I'm not very bash literate yet) by checking to see if the returned value is 1 character long and equal to a hyphen, then replacing with a special character. It would be easier if I could specify using exiftool a special character instead of the hyphen whenever a tag didn't have any data.

This is not a feature request, just an inquiry whether exiftool offers this control, perhaps by modifying a preference file somewhere.

Thanks,
Alex
Title: Re: How to replace the hyphen for an empty tag with something else?
Post by: Phil Harvey on October 26, 2012, 11:18:00 AM
Hi Alex,

At the moment there is no way to change the "-" output for a non-existent tag with the -f option.

Can't you just do a string compare and if the returned value equals "-" then the tag doesn't exist?

- Phil
Title: Re: How to replace the hyphen for an empty tag with something else?
Post by: inanealex on November 11, 2012, 02:10:03 PM
Thanks Phil, that is exactly what I've done. After all of the metadata is imported into my database, my DB script checks to see if the cell contents is one character long and a hypen, then substitutes a new string in its place.