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


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

Reply via email to