Parsing tag data

Started by StarGeek, August 08, 2013, 04:47:43 PM

Previous topic - Next topic

StarGeek

I'm trying to figure out the best way to print out part of a tag, in this case the Caption-Abstract.  In the tag, there's some data I want to print out that's between an end bracket+whitespace and a whitespace+start bracket ([bbcode] Data I want [/bbcode]).  I'm currently using this command
exiftool -p "${caption-abstract;s/.*?\]\s(.*?)\s\[.*/$1/s}" <file>
and that sorta feels messy and I'm wondering if I'm missing an easier solution due to my lack of Perl knowledge.

Any thoughts/suggestions?
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

Sometimes regular expressions can be messy.  The only alternative I can suggest right now isn't much better:

"${caption-abstract;/\]\s*(.*?)\s*\[/;$_=$1}"

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

StarGeek

Sounds good, thanks.

I was just thinking I might have been missing a simpler solution.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).