B
Ben Dover
i have some .jpg files created by a digital camera (nikon 5700).
the camera imbeds time and date in the binary.
viewing the binary file, i can see the numeric dates
"2003:09:10 21:55:01"
that number is the date/time.
i was able to do a regex to find it:
/\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d/
but then I had trouble finding it's position with index. it returns a
"-1" on every occurance.
here's the code:
#!/usr/bin/perl
# variables
$picFile='DSCN0155.JPG';
open (READ, $picFile);
while ($line=<READ>){
if ($line=~ /\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d/) {
$indexA=index ($line, "\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d");
$substrA=substr($line,$indexA,400);
print $indexA;
}
}
close (READ);
the camera imbeds time and date in the binary.
viewing the binary file, i can see the numeric dates
"2003:09:10 21:55:01"
that number is the date/time.
i was able to do a regex to find it:
/\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d/
but then I had trouble finding it's position with index. it returns a
"-1" on every occurance.
here's the code:
#!/usr/bin/perl
# variables
$picFile='DSCN0155.JPG';
open (READ, $picFile);
while ($line=<READ>){
if ($line=~ /\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d/) {
$indexA=index ($line, "\d\d\d\d:\d\d:\d\d \d\d:\d\d:\d\d");
$substrA=substr($line,$indexA,400);
print $indexA;
}
}
close (READ);