home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / vim45os2.zip / vim-4.5 / doc / xxd.man < prev   
Text File  |  1996-10-07  |  8KB  |  265 lines

  1.  
  2.  
  3.  
  4. XXD(1)                                                     XXD(1)
  5.  
  6.  
  7. NAME
  8.        xxd - make a hexdump or do the reverse.
  9.  
  10. SYNOPSIS
  11.        xxd -h[elp]
  12.        xxd [options] [infile [outfile]]
  13.        xxd -r[evert] [options] [infile [outfile]]
  14.  
  15. DESCRIPTION
  16.        xxd  creates a hex dump of a given file or standard input.
  17.        It can also convert a hex dump back to its original binary
  18.        form.   Like  uuencode(1)  and  uudecode(1)  it allows the
  19.        transmission of binary data in a `mail-safe' ASCII  repre-
  20.        sentation,  but  has the advantage of decoding to standard
  21.        output.  Moreover, it can be used to perform  binary  file
  22.        patching.
  23.  
  24. OPTIONS
  25.        If  no infile is given, standard input is read.  If infile
  26.        is specified as a `-' character, then input is taken  from
  27.        standard  input.  If no outfile is given (or a `-' charac-
  28.        ter is in its place), results are sent to standard output.
  29.  
  30.        Note that a "lazy" parser is used which does not check for
  31.        more than the first letter, unless the option is  followed
  32.        by  a parameter.  Spaces between an option and a following
  33.        parameter is optional, and in that case the long  name  is
  34.        known to make equivalent -c8, -c 8, -cols 8, and -cols8.
  35.  
  36.  
  37.        -a -autoskip
  38.               toggle  autoskip:  A single '*' replaces nul-lines.
  39.               Default off.
  40.  
  41.        -c cols | -cols cols
  42.               format <cols> octets per line. Default 16 (-i:  12,
  43.               -ps: 30). Max 64.
  44.  
  45.        -h -help
  46.               print a summary of available commands and exit.  No
  47.               hex dumping is performed.
  48.  
  49.        -i -include
  50.               output in C include file style.
  51.  
  52.        -l len | -len len
  53.               stop after <len> octets.
  54.  
  55.        -p -ps -postscript
  56.               output in postscript continuous hexdump style.
  57.  
  58.        -r -revert
  59.               reverse operation: convert (or patch) hexdump  into
  60.               binary.
  61.  
  62.  
  63.  
  64. Manual page for xxd        August 1996                          1
  65.  
  66.  
  67.  
  68.  
  69.  
  70. XXD(1)                                                     XXD(1)
  71.  
  72.  
  73.        -seek off
  74.               When  used after -r : revert with <offset> added to
  75.               file positions found in hexdump.
  76.  
  77.        -s [+][-]seek
  78.               start at <seek> bytes abs. (or +: rel.) infile off-
  79.               set.   seek  may  be hex (eg, 0x3f) or decimal (eg,
  80.               47).  + indicates that the seek is from  the  start
  81.               of  the input.  - indicates that the seek should be
  82.               that many characters from the end of the input.
  83.  
  84.        -u     use upper case hex letters (default is lower case).
  85.  
  86.        -v -version
  87.               show version string.
  88.  
  89. CAVEATS
  90.        xxd  -r  has  some  builtin magic.  The linenumbers at the
  91.        start of each line matter!
  92.  
  93.        Note that there is a difference between
  94.        % xxd -i file
  95.        and
  96.        % xxd -i < file
  97.  
  98.        xxd -s +seek has some semantic differences, as lseek()  is
  99.        used  to  "rewind" input.  A '+' makes a difference if the
  100.        input source is stdin, and if stdin's file position is not
  101.        at  the  start  of the file by the time xxd is started and
  102.        given its input.  The following examples may help to clar-
  103.        ify (or further confuse!)...
  104.  
  105.        Rewind  stdin before reading; needed because the `cat' has
  106.        already read to the end of stdin.
  107.        % sh -c 'cat > plain_copy; xxd -s 0 > hex_copy' < file
  108.  
  109.        Hexdump from file position 0x480 (=1024+128) onwards.  The
  110.        `+'  sign  means  "relative to the current position", thus
  111.        the `128' adds to the 1k where dd left off.
  112.        % sh -c 'dd of=plain_snippet bs=1k count=1; xxd -s +128  >
  113.        hex_snippet' < file
  114.  
  115.        Hexdump from file position 0x100 ( = 1024-768) on.
  116.        % sh -c 'dd of=plain_snippet bs=1k count=1; xxd -s +-768 >
  117.        hex_snippet' < file
  118.  
  119.        However, this is a rare situation and the use  of  `+'  is
  120.        rarely needed.
  121.  
  122. EXAMPLES
  123.        Print  everything  but  the  first  three  lines (hex 0x30
  124.        bytes) of file
  125.        % xxd -s 0x30 file
  126.  
  127.  
  128.  
  129.  
  130. Manual page for xxd        August 1996                          2
  131.  
  132.  
  133.  
  134.  
  135.  
  136. XXD(1)                                                     XXD(1)
  137.  
  138.  
  139.        Print 3 lines (hex 0x30 bytes) from the end of file
  140.        % xxd -s -0x30 file
  141.  
  142.        Print 120 bytes as continuous hexdump with 40  octets  per
  143.        line.
  144.        % xxd -l 120 -ps -c 20 xxd.1
  145.        2e544820585844203120224d616e75616c207061
  146.        676520666f7220787864220a2e5c220a2e5c2220
  147.        32317374204d617920313939360a2e5c22204d61
  148.        6e207061676520617574686f723a0a2e5c222020
  149.        2020546f6e79204e7567656e74203c746f6e7940
  150.        7363746e7567656e2e7070702e67752e6564752e
  151.  
  152.        Hexdump  the  first  120  bytes  of  this man page with 12
  153.        octets per line.
  154.        % xxd -l 120 -c 12 xxd.1
  155.        0000000: 2e54 4820 5858 4420 3120 224d  .TH XXD 1 "M
  156.        000000c: 616e 7561 6c20 7061 6765 2066  anual page f
  157.        0000018: 6f72 2078 7864 220a 2e5c 220a  or xxd"..\".
  158.        0000024: 2e5c 2220 3231 7374 204d 6179  .\" 21st May
  159.        0000030: 2031 3939 360a 2e5c 2220 4d61   1996..\" Ma
  160.        000003c: 6e20 7061 6765 2061 7574 686f  n page autho
  161.        0000048: 723a 0a2e 5c22 2020 2020 546f  r:..\"    To
  162.        0000054: 6e79 204e 7567 656e 7420 3c74  ny Nugent <t
  163.        0000060: 6f6e 7940 7363 746e 7567 656e  ony@sctnugen
  164.        000006c: 2e70 7070 2e67 752e 6564 752e  .ppp.gu.edu.
  165.  
  166.        Display just the date from the file xxd.1
  167.        % xxd -s 0x28 -l 12 -c 12 xxd.1
  168.        0000028: 3231 7374 204d 6179 2031 3939  21st May 199
  169.  
  170.        Copy input_file to output_file and prepend  100  bytes  of
  171.        value 0x00.
  172.        % xxd input_file | xxd -r -s 100 > output_file
  173.  
  174.        Patch the date in the file xxd.1
  175.        % echo '0000029: 3574 68' | xxd -r - xxd.1
  176.        % xxd -s 0x28 -l 12 -c 12 xxd.1
  177.        0000028: 3235 7468 204d 6179 2031 3939  25th May 199
  178.  
  179.        Create  a  65537 byte file with all bytes 0x00, except for
  180.        the last one which is 'A' (hex 0x41).
  181.        % echo '010000: 41' | xxd -r > file
  182.  
  183.        Hexdump this file with autoskip.
  184.        % xxd -a -c 12 file
  185.        0000000: 0000 0000 0000 0000 0000 0000  ............
  186.        *
  187.        000fffc: 0000 0000 40                   ....A
  188.  
  189.        Create a 1 byte file containing a  single  'A'  character.
  190.        The  number after '-r -s' adds to the linenumbers found in
  191.        the file; in effect, the leading bytes are suppressed.
  192.        % echo '010000: 41' | xxd -r -s -0x10000 > file
  193.  
  194.  
  195.  
  196. Manual page for xxd        August 1996                          3
  197.  
  198.  
  199.  
  200.  
  201.  
  202. XXD(1)                                                     XXD(1)
  203.  
  204.  
  205.        Use xxd as a filter within an editor  such  as  vim(1)  to
  206.        hexdump a region marked between `a' and `z'.
  207.        :'a,'z!xxd
  208.  
  209.        Use  xxd  as  a  filter within an editor such as vim(1) to
  210.        recover a binary hexdump marked between `a' and `z'.
  211.        :'a,'z!xxd -r
  212.  
  213.        Use xxd as a filter within an editor  such  as  vim(1)  to
  214.        recover  one  line of a hexdump.  Move the cursor over the
  215.        line and type:
  216.        !!xxd -r
  217.  
  218. RETURN VALUES
  219.        The following error values are returned:
  220.  
  221.        0      no errors encountered.
  222.  
  223.        1      parse error.
  224.  
  225. SEE ALSO
  226.        uuencode(1), uudecode(1), patch(1)
  227.  
  228. WARNINGS
  229.        Use entirely at your own risk.
  230.  
  231. BUGS
  232.        -seek3 and -skip3 (and others) do not work  (use  a  space
  233.        between the option and its parameter).
  234.  
  235. AUTHOR
  236.        (c) 1990-1996 by Juergen Weigert
  237.        <jnweiger@informatik.uni-erlangen.de>
  238.  
  239.        Distribute freely and credit me,
  240.        make money and share with me,
  241.        lose money and don't ask me.
  242.  
  243.        Manual page by Tony Nugent
  244.        <tony@sctnugen.ppp.gu.edu.au> <T.Nugent@sct.gu.edu.au>
  245.        Small changes by Bram Moolenaar.
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262. Manual page for xxd        August 1996                          4
  263.  
  264.  
  265.