* od for big_endian?
@ 2001-06-11 23:56 yosuke
2001-06-12 12:16 ` Oisin McGuinness
0 siblings, 1 reply; 4+ messages in thread
From: yosuke @ 2001-06-11 23:56 UTC (permalink / raw)
Hello all,
If this was FAQ, I am sorry.
I am wondering if version of od which works with big_endian files? I am
thinking of something line
od -convert big_endian -I file
to show content of the file interpreted as big endian file. I went
through DEC's od man page but couldn't find relevant info. did
deja/google search without luck...
Thank you very much!
--
yosuke kimura
Center for Energy and Environmental Resources
The Univ. of Texas at Austin, USA
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: od for big_endian?
2001-06-11 23:56 od for big_endian? yosuke
@ 2001-06-12 12:16 ` Oisin McGuinness
2001-06-12 15:22 ` yosuke
0 siblings, 1 reply; 4+ messages in thread
From: Oisin McGuinness @ 2001-06-12 12:16 UTC (permalink / raw)
yosuke@ccwf.cc.utexas.edu wrote:
>
>
> I am wondering if version of od which works with big_endian files? I am
> thinking of something line
>
> od -convert big_endian -I file
>
> to show content of the file interpreted as big endian file. I went
> through DEC's od man page but couldn't find relevant info. did
> deja/google search without luck...
>
What about the conv=swab option of the venerable dd utility?
Then pipe the results to od or whatever you want.
Oisin McGuinness
oisin@smbc-cm.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: od for big_endian?
2001-06-12 12:16 ` Oisin McGuinness
@ 2001-06-12 15:22 ` yosuke
2001-06-13 15:55 ` Oisin McGuinness
0 siblings, 1 reply; 4+ messages in thread
From: yosuke @ 2001-06-12 15:22 UTC (permalink / raw)
Oisin McGuinness <oisin@smbc-cm.com> wrote:
> yosuke@ccwf.cc.utexas.edu wrote:
>>
>>
>> I am wondering if version of od which works with big_endian files? I am
>> thinking of something line
>>
>> od -convert big_endian -I file
>>
>> to show content of the file interpreted as big endian file. I went
>> through DEC's od man page but couldn't find relevant info. did
>> deja/google search without luck...
>>
> What about the conv=swab option of the venerable dd utility?
> Then pipe the results to od or whatever you want.
Oisin,
Thank you for the tip. I never knew about dd's conv= command. I tried
but that didn't fix the problem completely. conv=swab swaps first and
second byte, third and forth byte and so on. What I want to do is swap
first and forth, second and third. So if I had
af46 00c9
I want
c900 46af
as output.
Also, I coudn't figure out how to pipe the dd output. I tried od=\| and
it created a file called '|'.
yosuke
--
yosuke kimura
Center for Energy and Environmental Resources
The Univ. of Texas at Austin, USA
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: od for big_endian?
2001-06-12 15:22 ` yosuke
@ 2001-06-13 15:55 ` Oisin McGuinness
0 siblings, 0 replies; 4+ messages in thread
From: Oisin McGuinness @ 2001-06-13 15:55 UTC (permalink / raw)
yosuke@ccwf.cc.utexas.edu wrote:
> Thank you for the tip. I never knew about dd's conv= command. I tried
> but that didn't fix the problem completely. conv=swab swaps first and
> second byte, third and forth byte and so on. What I want to do is swap
> first and forth, second and third. So if I had
>
> af46 00c9
>
> I want
>
> c900 46af
>
> as output.
OK, here is a perl 1 liner which acts as a filter to do this:
perl -e 'while((sysread STDIN, $buffer, 4)>0) { syswrite(STDOUT,
reverse($buffer), 4, 0);}'
(this may not handle the case where the input file is not 4*something in
size correctly, and as
per the perl documentation, one should really handle interrupted system
reads and partial writes, see
the perl documentation of syswrite for details.
>
> Also, I coudn't figure out how to pipe the dd output. I tried od=\| and
> it created a file called '|'.
You don't need to specify of=| to dd to make it act as a filter, just
leave out
the of= specification; if dd had done the job then,
dd conv=swab <infile | od
would have displayed stuff.
>
--
Oisin McGuinness
SMBC Capital Markets
277 Park Avenue
New York NY 10172
USA
(212)-224-4913, email: oisin@smbc-cm.com
(Changed April 2 2001 from oisin@sbcm.com.)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-06-13 15:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-06-11 23:56 od for big_endian? yosuke
2001-06-12 12:16 ` Oisin McGuinness
2001-06-12 15:22 ` yosuke
2001-06-13 15:55 ` Oisin McGuinness
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox