문제

I'm trying to search hundreds of files for the keyword 'Description' and then output the name of a file that contains the keyword.

Executing a simple exiftool * | grep Description (in UNIX) gives me the line in the file but not the name of the file that contains the line. By default, the file name and description are output on two separate lines like the two below.

File Name                       : [Name of file listed here]
Description                     : [a long string here]

I think there's a way to do this in ExifTool without even needing to pipe the output to grep but I haven't been able to figure it out.

도움이 되었습니까?

해결책

There are lots of ways to do this. Here is one:

exiftool -if '$description' -filename -r .

or if you want both the file name and description on the same line:

exiftool -p '$filename $description' -r -q -q .

and if you also want the directory:

exiftool -p '$directory/$filename $description' -r -q -q .

  • Phil

다른 팁

Assuming the two were on lines right next to each other, grep also accepts the -B 1 switch, which stands for include the number of lines before the match.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top