7z e ca-2016.0227-256152.nef.7z -y -o $TMP ca-2016.0227-256152.nef 7z e ca-2016.0227-256152.nef.7z -y ca-2016.0227-256152.nef.sts # Show only md5, not filename. PSR is cmd line s/// w/Perl regexp md5sum $TMP/ca-2016.0227-256354.nef |
psr.pl "s/^(\\w+).*$/\$1/" > freq.tmp # Extract original md5 as last w/s token on first line head -n1 ca-2016.0227-256354.nef.sts |
psr.pl "s/^.*\\s+(\\w+)\\s*\$/\$1/" >> freq.tmp # Show frequency distribution, expect 2 copies, same md5, 1 line freq.pl freq.tmp # Hash distinct tokens 2 ebf5216f8bc9afcd0eb208c4b5a0a18a rm $TMP/ca-2016.0227-*.nef ca-2016.0227-256354.nef.sts freq.tmp etc. etc. etc... #### Perl: Zip=ca-2016.0227-256359.nef.7z -> ca-2016.0227-*.nef/.sts ($base=$zip) =~ s/\.7z$//; # Strip .7z suffix -> NEF name %zext=('nef' => "$base", 'sts' => "$base.sts"); # Zip Extract # Overwrite zip internal filenames with binary file contents &extract_zip('/some/dir/ca-2016.0227-256359.nef.7z', \%zext); my $new_md5=md5_hex($zext{nef}); if($zext{sts} =~ m/$new_md5) { &Success(); } else(&dispair())