- Author: EJ Makela
- Creation Date: 2019-02-17
ExifTool allows a user to use "Perl-like" expressions to search and replace text in tags. In the following examples, a file ("image.jpg") was processed using a variety of different strings to see how the results would differ.
The following command was executed, with EXPR substituted with the expression listed in the first column of the table. The values in that column alternate between the substitution operator (s///) or the translation operator (tr///).
$ exiftool -p '${FileName;EXPR}' image.jpg
EXPR | RESULT | FILE-EXT INVALIDATED? | SEE NOTE |
---|---|---|---|
s/image/abcd/ | abcd.jpg | ||
tr/image/abcd/ | abcdd.jpd | YES | |
s/aegim/abcd/ | image.jpg | 1 | |
tr/aegim/abcd/ | ddacb.jpc | YES | 1 |
s/image/12345/ | 12345.jpg | ||
tr/image/12345/ | 12345.jp4 | YES | |
s/image/1234/ | 1234.jpg | ||
tr/image/1234/ | 12344.jp4 | YES | |
s/image/123456/ | 123456.jpg | ||
tr/image/123456/ | 12345.jp4 | YES | 2 |
- "aegim" is alphabetized string of "image".
- ExifTool error: "Warning: Replacement list is longer than search list for 'filename' - image.jpg"