Sorry about that...forgot to reply to all. Working with 4 languages at once tends to turn my brain to mush.
-----Original Message----- From: Bob Showalter [mailto:[EMAIL PROTECTED]] Sent: Monday, June 24, 2002 2:41 PM To: 'Andrew Stone' Subject: RE: Binary File Pattern Matching Send this to the list. I really don't want to keep private threads going. Thanks. > -----Original Message----- > From: Andrew Stone [mailto:[EMAIL PROTECTED]] > Sent: Monday, June 24, 2002 2:26 PM > To: Bob Showalter > Subject: RE: Binary File Pattern Matching > > > Bob, > > Thanks, and for some more info, the file is all integer based. So > I know that the ASCII string scenario doesn't come into play. These > files are all generated by FORTRAN where everything (even the > characters) > is stored as INTEGER*4. That should help me then, correct? > > thanks for the help, > andy > > -----Original Message----- > From: Bob Showalter [mailto:[EMAIL PROTECTED]] > Sent: Monday, June 24, 2002 2:19 PM > To: 'Andrew Stone'; [EMAIL PROTECTED] > Subject: RE: Binary File Pattern Matching > > > > -----Original Message----- > > From: Andrew Stone [mailto:[EMAIL PROTECTED]] > > Sent: Monday, June 24, 2002 1:29 PM > > To: [EMAIL PROTECTED] > > Subject: Binary File Pattern Matching > > > > > > Hello all, > > > > I'm having a problem with (I suppose) pattern matching. > > Here's the task: To take binary data from windows(little-endian) > > and convert to Unix(big-endian). > > Well, Perl's pack() and unpack() functions can help with that. > > > If the file is all numeric, I don't > > have a problem, but it isn't. I need to be able to recognize that > > one of the four bytes is non-numeric data (spaces, alpha, > > punctuation..). > > If one of the four is non-numeric then I don't want to do the byte > > swapping. Right now if there is character data it gets > > swapped so 'TEST' > > becomes 'TSET'. I've been searching the web, but haven't > > found anything > > that works for me. > > This really can't be done. The sequence 'TEST' in the file may be > an ASCII string with the word test. Or, it may be the long integer > 1413829460 packed in network (big-endian) order. Or something else > altogether. There is no way to say which it is without knowing > something about the structure of the file. > > $ perl -le 'print pack "N", 1413829460' > TEST > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]