From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,39fcc1d35fe1da5f X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 2001-06-13 10:30:54 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.cwix.com!sjc-peer.news.verio.net!news.verio.net!iad-read.news.verio.net.POSTED!not-for-mail Message-ID: <3B278D09.BE85D77E@smbc-cm.com> From: Oisin McGuinness Organization: SMBC Capital Markets X-Mailer: Mozilla 4.74 [en] (WinNT; U) X-Accept-Language: en,el MIME-Version: 1.0 Newsgroups: comp.sys.dec Subject: Re: od for big_endian? References: <9g3lqk$qc7$1@geraldo.cc.utexas.edu> <3B260804.93664AD6@smbc-cm.com> <9g5c3r$jaq$1@geraldo.cc.utexas.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Wed, 13 Jun 2001 11:55:53 -0400 NNTP-Posting-Host: 204.141.189.14 X-Complaints-To: abuse@verio.net X-Trace: iad-read.news.verio.net 992447737 204.141.189.14 (Wed, 13 Jun 2001 15:55:37 GMT) NNTP-Posting-Date: Wed, 13 Jun 2001 15:55:37 GMT Xref: archiver1.google.com comp.sys.dec:4473 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 -- 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.)