1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

byte swap

Discussion in 'Linux and Unix' started by ro, Jan 25, 2002.

Thread Status:
Not open for further replies.
  1. ro

    ro Thread Starter

    Joined:
    Aug 25, 2000
    Messages:
    2
    does anyone know a way of reversing the byte order (big endian/little endian) of a binary file in UNIX?
     
  2. codejockey

    codejockey

    Joined:
    Feb 11, 2002
    Messages:
    1,405
    You might check out the dd command and the conv=swab (and similar) options.

    The basic syntax is: dd if=input-filename of=output-filename [options] where input-filename and output-filename default to stdin and stdout, respectively. So, for example, to copy a file named gack to a file named blort so that blort will have a byte-reversed order relative to gack you would use:

    dd if=gack of=blort conv=swab

    Note that dd will also allow you to perform many other conversions (even ASCII-EBCDIC!) as well as re-blocking. Hope this helps.
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Similar Threads - byte swap
  1. Johnny b
    Replies:
    4
    Views:
    463
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/66330

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice