bash scripting help

Stefan Krah sfk1 at bigfoot.com
Thu Mar 24 12:04:58 PST 2005


* Sébastien Maerten <maerten.sebastien at laposte.net> wrote:
> Stefan Krah wrote:
>> [GNU find]:
>> 
>> find . -name '*.[Jj][Pp][Gg]' -print0 | xargs -0 jhead \
>>         | awk '/^File name/{printf "NAME: %s\t", $4} \
>>                /^File size/{printf "SIZE: %s\t", $4} \
>>                /^Date\/Time/{printf "DATE: %s %s\t", $3, $4} \
>>                /^Resolution/{printf "RESO: %s x %s\n", $3, $5}'
> 
> Wouah ! This seems nice to my untrained eyes. I'll try to understand it
> now, and I'll be back with comments. Thank you.
> 
>> Untested, I don't know the exact output of jhead. And find will of course
>> descend further unless you prevent that with -maxdepth or similar.
> 
> I need to man awk and man xargs before I can comment on -maxdepth. I'll
> do now.

-maxdepth would be `man find`. ;)

> BTW, if anybody has a "better" tool than jhead for that, I'd appreciate
> to know about it.

For the copied/renamed files you could use md5sum to find duplicates:

find . -type f -print0 | xargs -0 md5sum | sort | uniq -w 32 -D


Stefan Krah



More information about the lfs-chat mailing list