On 9/12/05, Gregory K. Ruiz-Ade <[EMAIL PROTECTED]> wrote:
> On Sep 12, 2005, at 4:50 AM, m ike wrote:
> 
> > the best that I can come up with, however, is to use bed to find
> > the byte
> > offset of the beginning and end of each jpg. save all the offsets
> > in a file. then use tail and head with -c to dissect each jpg.
> >
> 
> You might be better served by dd, which happily works on binary files
> with bytewise precision (see the seek=, bs= and count= options).
> 
> 
> > but since I know the beginning and ending hexadecimal markers for
> > exif files
> > (FF D8 and FF D9), it seems that there should be a way to script
> > this task.
> > it would be extremely helpful to be able to use grep to find the
> > offsets,
> > but I cannot figure out how to use grep in this manner, and have
> > not been
> > able to find an alternative to grep that will do this.
> >
> 
> Hopefully someone else will have some sage advice on this part...

There are two parts to this problem.
1) locating the <begin> and <end> markers.
2) using this information to copy the desired data to another file.

I myself would write a small C program to do this.  Possibly Gawk
could be coerced into treating the data, using its BINMODE command,
although this might be more difficult than using C.   Some might use
Perl.

If you are restricted to standard utilities, a combination of od and grep can do
the identification, while dd can do the copying.

    carl
-- 
    carl lowenstein         marine physical lab     u.c. san diego
                                                 [EMAIL PROTECTED]


--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to