Bob,

Works a treat!  I guess I need to add 'perl' to my toolbox.

Many thanks & regards

Mike Lockhart
Tier 2 Analyst
713-839-3188
[EMAIL PROTECTED]

-----Original Message-----
From: Bob Proulx [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 30, 2006 7:24 PM
To: Mike Lockhart
Cc: bug-coreutils@gnu.org
Subject: Re: enhancement request for a long word byte swap option for
'dd'

Mike Lockhart wrote:
> What I'm looking for is an end-to-end swap.  e.g. swap 0000f841 to
> 41f80000 so that 'od' will return 3.1000000e+01

What options are you using to 'od'?

> I can write a byte-swap function in awk, but I can't translate the
> floats into something I can understand - it would require getting into
> the bit world:

Is perl a possibility?  Because the perl snippet I posted should work
fine if perl is available.  It is using only basic perl functionality.

  printf "abcdefghijklmno\n" | od -tx
  0000000 64636261 68676665 6c6b6a69 0a6f6e6d

  printf "abcdefghijklmno\n" \
  | perl -e 'while (sysread(STDIN,$d,4)){print
pack("N",unpack("V",$d));}' \
  | od -tx
  0000000 61626364 65666768 696a6b6c 6d6e6f0a

There you go...

Bob
----------------------------------------------------------------------
This e-mail, including any attached files, may contain confidential and 
privileged information for the sole use of the intended recipient.  Any review, 
use, distribution, or disclosure by others is strictly prohibited.  If you are 
not the intended recipient (or authorized to receive information for the 
intended recipient), please contact the sender by reply e-mail and delete all 
copies of this message.


_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to