Re: editing a binary file

2009-12-22 Thread Anton Shterenlikht
well, one of my colleagues pointed out a feature of fortran 2003, which I, being an idiot, have missed. YOu have access='stream' in f2003, which is all I need. No record separators, just data. many thanks for all your help and advice. anton -- Anton Shterenlikht Room 2.6, Queen's Building

Editing a binary file

2009-12-20 Thread Mark Terribile
On Fri, Dec 18, 2009 at 09:33:49AM -0700, Warren Block wrote: per...@pluto.rain.com wrote: Greg Larkin glar...@freebsd.org wrote: ... truncate -4 myfile should get rid of the last four bytes. Maybe there's a similar efficient way to truncate the start of a file. This

Re: editing a binary file

2009-12-19 Thread Anton Shterenlikht
On Thu, Dec 17, 2009 at 06:38:04PM -0700, Warren Block wrote: On Fri, 18 Dec 2009, Anton Shterenlikht wrote: I'm creating binary files in fortran. Fortran adds 4 byte record delimiters at the beginning and the end of each record, which, in the case of a binary file, is just at the

Re: editing a binary file

2009-12-19 Thread Anton Shterenlikht
On Thu, Dec 17, 2009 at 08:45:02PM -0500, Greg Larkin wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Warren Block wrote: On Fri, 18 Dec 2009, Anton Shterenlikht wrote: I'm creating binary files in fortran. Fortran adds 4 byte record delimiters at the beginning and the end of

Re: editing a binary file

2009-12-19 Thread Anton Shterenlikht
On Fri, Dec 18, 2009 at 09:33:49AM -0700, Warren Block wrote: per...@pluto.rain.com wrote: Greg Larkin glar...@freebsd.org wrote: ... truncate -4 myfile should get rid of the last four bytes. Maybe there's a similar efficient way to truncate the start of a file. This should do

Re: editing a binary file

2009-12-18 Thread Matthew Seaman
Anton Shterenlikht wrote: On Fri, Dec 18, 2009 at 02:09:58AM +0100, Rolf Nielsen wrote: Anton Shterenlikht wrote: I'm creating binary files in fortran. Fortran adds 4 byte record delimiters at the beginning and the end of each record, which, in the case of a binary file, is just at the

Re: editing a binary file

2009-12-18 Thread Giorgos Keramidas
On Fri, 18 Dec 2009 01:29:18 +, Anton Shterenlikht me...@bristol.ac.uk wrote: My bet would be /usr/ports/editors/hexedit. Been a while since I've used it, but AFAIR, it has a curses or a curses like interface, and it's fairly simple to use, yet sufficiently powerful for most normal binary

Re: editing a binary file

2009-12-18 Thread perryh
Greg Larkin glar...@freebsd.org wrote: ... truncate -4 myfile should get rid of the last four bytes. Maybe there's a similar efficient way to truncate the start of a file. This should do it: dd if=oldfile of=newfile bs=1 skip=4 Or, perhaps marginally more efficient: dd if=oldfile

Re: editing a binary file

2009-12-18 Thread Nick Barnes
If your Fortran file has the same word size and enddian-ness as your C, this simple program convert.c will strip all the record length fields. I just knocked it up now, no warranty, etc, but it works for me. Use as a pipe: $ ls convert.c test.f $ gcc -Wall -Werror -ansi -pedantic

Re: editing a binary file

2009-12-18 Thread Markiyan Kushnir
If you don't mind, I would add fixed buffer processing to your program. For some really huge files (or any other type of stream) which have really huge records, reading entire records into memory would get the box down. Markiyan /* convert.c: remove record length fields from Fortran output

Re: editing a binary file

2009-12-18 Thread Warren Block
per...@pluto.rain.com wrote: Greg Larkin glar...@freebsd.org wrote: ... truncate -4 myfile should get rid of the last four bytes. Maybe there's a similar efficient way to truncate the start of a file. This should do it: dd if=oldfile of=newfile bs=1 skip=4 Or, perhaps marginally more

Re: editing a binary file

2009-12-18 Thread Nick Barnes
At 2009-12-18 16:33:49+, Warren Block writes: per...@pluto.rain.com wrote: Greg Larkin glar...@freebsd.org wrote: ... truncate -4 myfile should get rid of the last four bytes. Maybe there's a similar efficient way to truncate the start of a file. This should do it:

Re: editing a binary file

2009-12-18 Thread Anton Shterenlikht
On Fri, Dec 18, 2009 at 09:33:49AM -0700, Warren Block wrote: per...@pluto.rain.com wrote: Greg Larkin glar...@freebsd.org wrote: ... truncate -4 myfile should get rid of the last four bytes. Maybe there's a similar efficient way to truncate the start of a file. This should do

Re: editing a binary file

2009-12-18 Thread Anton Shterenlikht
On Fri, Dec 18, 2009 at 04:38:16PM +, Nick Barnes wrote: At 2009-12-18 16:33:49+, Warren Block writes: per...@pluto.rain.com wrote: Greg Larkin glar...@freebsd.org wrote: ... truncate -4 myfile should get rid of the last four bytes. Maybe there's a similar efficient

Re: editing a binary file

2009-12-18 Thread Matthew Seaman
Nick Barnes wrote: All very interesting, but the OP is wanting to lose all the Fortran record markers, not just the first (and last) four bytes of the file. The record markers precede and follow each record, and give the record's length. The size and enddian-ness of the record marker itself

Re: editing a binary file

2009-12-18 Thread ocean
Anton Shterenlikht wrote: On Fri, Dec 18, 2009 at 09:33:49AM -0700, Warren Block wrote: per...@pluto.rain.com wrote: Greg Larkin glar...@freebsd.org wrote: ... truncate -4 myfile should get rid of the last four bytes. Maybe there's a similar efficient way to truncate the start of a file.

editing a binary file

2009-12-17 Thread Anton Shterenlikht
I'm creating binary files in fortran. Fortran adds 4 byte record delimiters at the beginning and the end of each record, which, in the case of a binary file, is just at the beginning and at the end of the file. I need to delete these record delimiters, because the software I use to visualise the

Re: editing a binary file

2009-12-17 Thread Rolf Nielsen
Anton Shterenlikht wrote: I'm creating binary files in fortran. Fortran adds 4 byte record delimiters at the beginning and the end of each record, which, in the case of a binary file, is just at the beginning and at the end of the file. I need to delete these record delimiters, because the

Re: editing a binary file

2009-12-17 Thread Anton Shterenlikht
On Fri, Dec 18, 2009 at 02:09:58AM +0100, Rolf Nielsen wrote: Anton Shterenlikht wrote: I'm creating binary files in fortran. Fortran adds 4 byte record delimiters at the beginning and the end of each record, which, in the case of a binary file, is just at the beginning and at the end of

Re: editing a binary file

2009-12-17 Thread Rolf Nielsen
Anton Shterenlikht wrote: On Fri, Dec 18, 2009 at 02:09:58AM +0100, Rolf Nielsen wrote: Anton Shterenlikht wrote: I'm creating binary files in fortran. Fortran adds 4 byte record delimiters at the beginning and the end of each record, which, in the case of a binary file, is just at the

Re: editing a binary file

2009-12-17 Thread Warren Block
On Fri, 18 Dec 2009, Anton Shterenlikht wrote: I'm creating binary files in fortran. Fortran adds 4 byte record delimiters at the beginning and the end of each record, which, in the case of a binary file, is just at the beginning and at the end of the file. I need to delete these record

Re: editing a binary file

2009-12-17 Thread Greg Larkin
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Warren Block wrote: On Fri, 18 Dec 2009, Anton Shterenlikht wrote: I'm creating binary files in fortran. Fortran adds 4 byte record delimiters at the beginning and the end of each record, which, in the case of a binary file, is just at the