[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Tue, 29 Apr 2008 05:51:37 +0300
It's because you're using print. What you want is
printf("%c%c%c%c",0x0d,0x0a,0x36,0x37) > "outputfile.bin";
printf() will output only what you tell it to. If you leave off
the \n in the format string, it won't come out.
Hmm, re-reading your note, that may not be your problem... On Linux
with current gawk, I get:
$ od -x outputfile.bin
0000000 0a0d 3736 000a
which demonstrates what I thought was the problem.
I'm guessing you're on Windows. Please make sure you have an up-to-date
version of gawk, and also try the printf() version.
> Date: Mon, 28 Apr 2008 21:58:56 -0400
> From: Charles Weaver <address@hidden>
> Subject: 0D0A
> To: address@hidden
> I don't know if this is a bug or a feature but as near as I can tell the =
> following line:
> print sprintf("%c%c%c%c",0x0d,0x0a,0x36,0x37) > "outputfile.bin";
> generates the following binary: 0d0d0a3637
> It took me the better part of a day to figure out that it was putting in =
> the extra 0d and I have not been able to figure out how to stop it.
- Re: 0D0A,
Aharon Robbins <=
- 0D0A, Charles Weaver, 2008/04/29