[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Help needed for 'sed'-ing a Hex file

On Tue, 2003-04-22 at 19:38, Colin Watson wrote:
> On Tue, Apr 22, 2003 at 06:16:47PM +0200, Ronald van Engelen wrote:
> > I'm trying to use some commands from base-utils (like sed, grep and awk)
> > to extract a list of filenames from a Cubase generated RIFF file. The
> > file is a HEX file
> Binary, you mean?
> > and I'm having the following problems at the start of the process:
> > 
> > 1. Extract text from the hex file: 
> > I've looked at hexdump and hexcurses, but both won't let me make a
> > text-only dump of the strings in the hex file. Now I have to use
> > KHEXEDIT and as you may understand I would like to have a more basic
> > method:
> 'strings' from the binutils package is probably much easier.
You're absolutely right, strings is just what i needed. I've been able
to get the text using the 'hexcat' package, but strings does a much
better job.

> > 2. KHEXEDIT outputs a standard text file with line-wrapping at column
> > 80. I need to get rid of the EOL markers as well, because the filenames
> > I'm looking for are spread on multiple lines. I've tried a lot but it
> > seems to me that sed can't find strings which are not on one line(?).
> > Currently I use Anjuta to replace the LF markers with nothing.
> perl's regular expressions are a better choice for handling newlines
> than sed's, but I'd need a clearer example of what you're trying to do.
> However, if you use 'strings', I don't think you'll have this problem in
> the first place.
I will look into using perl for these kinds of jobs. For now, I'll stick
with regex matching from sed. 

> Cheers,
> Colin Watson                                  [cjwatson@flatline.org.uk]

Thanks a lot,

Reply to: