Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | .TH XXD 1 "August 1996" "Manual page for xxd" |
| 2 | .\" |
| 3 | .\" 21st May 1996 |
| 4 | .\" Man page author: |
| 5 | .\" Tony Nugent <tony@sctnugen.ppp.gu.edu.au> <T.Nugent@sct.gu.edu.au> |
| 6 | .\" Changes by Bram Moolenaar <Bram@vim.org> |
| 7 | .SH NAME |
| 8 | .I xxd |
| 9 | \- make a hexdump or do the reverse. |
| 10 | .SH SYNOPSIS |
| 11 | .B xxd |
| 12 | \-h[elp] |
| 13 | .br |
| 14 | .B xxd |
| 15 | [options] [infile [outfile]] |
| 16 | .br |
| 17 | .B xxd |
| 18 | \-r[evert] [options] [infile [outfile]] |
| 19 | .SH DESCRIPTION |
| 20 | .I xxd |
| 21 | creates a hex dump of a given file or standard input. |
| 22 | It can also convert a hex dump back to its original binary form. |
| 23 | Like |
Bram Moolenaar | 4317d9b | 2005-03-18 20:25:31 +0000 | [diff] [blame] | 24 | .BR uuencode (1) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 25 | and |
Bram Moolenaar | 4317d9b | 2005-03-18 20:25:31 +0000 | [diff] [blame] | 26 | .BR uudecode (1) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 27 | it allows the transmission of binary data in a `mail-safe' ASCII representation, |
| 28 | but has the advantage of decoding to standard output. |
| 29 | Moreover, it can be used to perform binary file patching. |
| 30 | .SH OPTIONS |
| 31 | If no |
| 32 | .I infile |
| 33 | is given, standard input is read. |
| 34 | If |
| 35 | .I infile |
| 36 | is specified as a |
| 37 | .RB \` \- ' |
| 38 | character, then input is taken from standard input. |
| 39 | If no |
| 40 | .I outfile |
| 41 | is given (or a |
| 42 | .RB \` \- ' |
| 43 | character is in its place), results are sent to standard output. |
| 44 | .PP |
| 45 | Note that a "lazy" parser is used which does not check for more than the first |
| 46 | option letter, unless the option is followed by a parameter. |
| 47 | Spaces between a single option letter and its parameter are optional. |
| 48 | Parameters to options can be specified in decimal, hexadecimal or octal |
| 49 | notation. |
| 50 | Thus |
| 51 | .BR \-c8 , |
| 52 | .BR "\-c 8" , |
| 53 | .B \-c 010 |
| 54 | and |
| 55 | .B \-cols 8 |
| 56 | are all equivalent. |
| 57 | .PP |
| 58 | .TP |
| 59 | .IR \-a " | " \-autoskip |
| 60 | toggle autoskip: A single '*' replaces nul-lines. Default off. |
| 61 | .TP |
| 62 | .IR \-b " | " \-bits |
| 63 | Switch to bits (binary digits) dump, rather than hexdump. |
| 64 | This option writes octets as eight digits "1"s and "0"s instead of a normal |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 65 | hexadecimal dump. Each line is preceded by a line number in hexadecimal and |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 66 | followed by an ascii (or ebcdic) representation. The command line switches |
| 67 | \-r, \-p, \-i do not work with this mode. |
| 68 | .TP |
| 69 | .IR "\-c cols " | " \-cols cols" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 70 | format |
| 71 | .RI < cols > |
| 72 | octets per line. Default 16 (\-i: 12, \-ps: 30, \-b: 6). Max 256. |
| 73 | .TP |
| 74 | .IR \-E " | " \-EBCDIC |
| 75 | Change the character encoding in the righthand column from ASCII to EBCDIC. |
| 76 | This does not change the hexadecimal representation. The option is |
| 77 | meaningless in combinations with \-r, \-p or \-i. |
| 78 | .TP |
Bram Moolenaar | 4dcdf29 | 2015-03-05 17:51:15 +0100 | [diff] [blame] | 79 | .IR \-e |
| 80 | Switch to little-endian hexdump. |
| 81 | This option treats byte groups as words in little-endian byte order. |
| 82 | The default grouping of 4 bytes may be changed using |
| 83 | .RI "" \-g . |
| 84 | This option only applies to hexdump, leaving the ASCII (or EBCDIC) |
| 85 | representation unchanged. |
| 86 | The command line switches |
| 87 | \-r, \-p, \-i do not work with this mode. |
| 88 | .TP |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 89 | .IR "\-g bytes " | " \-groupsize bytes" |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 90 | separate the output of every |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 91 | .RI < bytes > |
| 92 | bytes (two hex characters or eight bit-digits each) by a whitespace. |
| 93 | Specify |
| 94 | .I \-g 0 |
| 95 | to suppress grouping. |
| 96 | .RI < Bytes "> defaults to " 2 |
Bram Moolenaar | 4dcdf29 | 2015-03-05 17:51:15 +0100 | [diff] [blame] | 97 | in normal mode, \fI4\fP in little-endian mode and \fI1\fP in bits mode. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 98 | Grouping does not apply to postscript or include style. |
| 99 | .TP |
| 100 | .IR \-h " | " \-help |
| 101 | print a summary of available commands and exit. No hex dumping is performed. |
| 102 | .TP |
| 103 | .IR \-i " | " \-include |
| 104 | output in C include file style. A complete static array definition is written |
| 105 | (named after the input file), unless xxd reads from stdin. |
| 106 | .TP |
| 107 | .IR "\-l len " | " \-len len" |
| 108 | stop after writing |
| 109 | .RI < len > |
| 110 | octets. |
| 111 | .TP |
Bram Moolenaar | 4dcdf29 | 2015-03-05 17:51:15 +0100 | [diff] [blame] | 112 | .I \-o offset |
| 113 | add |
| 114 | .RI < offset > |
| 115 | to the displayed file position. |
| 116 | .TP |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 117 | .IR \-p " | " \-ps " | " \-postscript " | " \-plain |
| 118 | output in postscript continuous hexdump style. Also known as plain hexdump |
| 119 | style. |
| 120 | .TP |
| 121 | .IR \-r " | " \-revert |
| 122 | reverse operation: convert (or patch) hexdump into binary. |
| 123 | If not writing to stdout, xxd writes into its output file without truncating |
| 124 | it. Use the combination |
| 125 | .I \-r \-p |
| 126 | to read plain hexadecimal dumps without line number information and without a |
| 127 | particular column layout. Additional Whitespace and line-breaks are allowed |
| 128 | anywhere. |
| 129 | .TP |
| 130 | .I \-seek offset |
| 131 | When used after |
Bram Moolenaar | 4317d9b | 2005-03-18 20:25:31 +0000 | [diff] [blame] | 132 | .IR \-r : |
| 133 | revert with |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 134 | .RI < offset > |
| 135 | added to file positions found in hexdump. |
| 136 | .TP |
Bram Moolenaar | 4317d9b | 2005-03-18 20:25:31 +0000 | [diff] [blame] | 137 | .I \-s [+][\-]seek |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 138 | start at |
| 139 | .RI < seek > |
| 140 | bytes abs. (or rel.) infile offset. |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 141 | \fI+ \fRindicates that the seek is relative to the current stdin file position |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 142 | (meaningless when not reading from stdin). \fI\- \fRindicates that the seek |
| 143 | should be that many characters from the end of the input (or if combined with |
Bram Moolenaar | 4317d9b | 2005-03-18 20:25:31 +0000 | [diff] [blame] | 144 | \fI+\fR: before the current stdin file position). |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 145 | Without \-s option, xxd starts at the current file position. |
| 146 | .TP |
| 147 | .I \-u |
| 148 | use upper case hex letters. Default is lower case. |
| 149 | .TP |
| 150 | .IR \-v " | " \-version |
| 151 | show version string. |
| 152 | .SH CAVEATS |
| 153 | .PP |
| 154 | .I xxd \-r |
| 155 | has some builtin magic while evaluating line number information. |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 156 | If the output file is seekable, then the linenumbers at the start of each |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 157 | hexdump line may be out of order, lines may be missing, or overlapping. In |
| 158 | these cases xxd will lseek(2) to the next position. If the output file is not |
| 159 | seekable, only gaps are allowed, which will be filled by null-bytes. |
| 160 | .PP |
| 161 | .I xxd \-r |
| 162 | never generates parse errors. Garbage is silently skipped. |
| 163 | .PP |
| 164 | When editing hexdumps, please note that |
| 165 | .I xxd \-r |
| 166 | skips everything on the input line after reading enough columns of hexadecimal |
| 167 | data (see option \-c). This also means, that changes to the printable ascii (or |
| 168 | ebcdic) columns are always ignored. Reverting a plain (or postscript) style |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 169 | hexdump with xxd \-r \-p does not depend on the correct number of columns. Here anything that looks like a pair of hex-digits is interpreted. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 170 | .PP |
| 171 | Note the difference between |
| 172 | .br |
| 173 | \fI% xxd \-i file\fR |
| 174 | .br |
| 175 | and |
| 176 | .br |
Bram Moolenaar | 4317d9b | 2005-03-18 20:25:31 +0000 | [diff] [blame] | 177 | \fI% xxd \-i < file\fR |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 178 | .PP |
Bram Moolenaar | 3991dab | 2006-03-27 17:01:56 +0000 | [diff] [blame] | 179 | .I xxd \-s +seek |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 180 | may be different from |
Bram Moolenaar | 4317d9b | 2005-03-18 20:25:31 +0000 | [diff] [blame] | 181 | .IR "xxd \-s seek" , |
| 182 | as lseek(2) is used to "rewind" input. A '+' |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 183 | makes a difference if the input source is stdin, and if stdin's file position |
| 184 | is not at the start of the file by the time xxd is started and given its input. |
| 185 | The following examples may help to clarify (or further confuse!)... |
| 186 | .PP |
| 187 | Rewind stdin before reading; needed because the `cat' has already read to the |
| 188 | end of stdin. |
| 189 | .br |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 190 | \fI% sh \-c "cat > plain_copy; xxd \-s 0 > hex_copy" < file\fR |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 191 | .PP |
| 192 | Hexdump from file position 0x480 (=1024+128) onwards. |
| 193 | The `+' sign means "relative to the current position", thus the `128' adds to |
| 194 | the 1k where dd left off. |
| 195 | .br |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 196 | \fI% sh \-c "dd of=plain_snippet bs=1k count=1; xxd \-s +128 > hex_snippet" < file\fR |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 197 | .PP |
Bram Moolenaar | 4317d9b | 2005-03-18 20:25:31 +0000 | [diff] [blame] | 198 | Hexdump from file position 0x100 ( = 1024\-768) on. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 199 | .br |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 200 | \fI% sh \-c "dd of=plain_snippet bs=1k count=1; xxd \-s +\-768 > hex_snippet" < file\fR |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 201 | .PP |
| 202 | However, this is a rare situation and the use of `+' is rarely needed. |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 203 | The author prefers to monitor the effect of xxd with strace(1) or truss(1), whenever \-s is used. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 204 | .SH EXAMPLES |
| 205 | .PP |
| 206 | .br |
| 207 | Print everything but the first three lines (hex 0x30 bytes) of |
Bram Moolenaar | 3991dab | 2006-03-27 17:01:56 +0000 | [diff] [blame] | 208 | .BR file . |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 209 | .br |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 210 | \fI% xxd \-s 0x30 file\fR |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 211 | .PP |
| 212 | .br |
| 213 | Print 3 lines (hex 0x30 bytes) from the end of |
Bram Moolenaar | 3991dab | 2006-03-27 17:01:56 +0000 | [diff] [blame] | 214 | .BR file . |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 215 | .br |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 216 | \fI% xxd \-s \-0x30 file\fR |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 217 | .PP |
| 218 | .br |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 219 | Print 120 bytes as continuous hexdump with 20 octets per line. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 220 | .br |
| 221 | \fI% xxd \-l 120 \-ps \-c 20 xxd.1\fR |
| 222 | .br |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 223 | 2e54482058584420312022417567757374203139 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 224 | .br |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 225 | 39362220224d616e75616c207061676520666f72 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 226 | .br |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 227 | 20787864220a2e5c220a2e5c222032317374204d |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 228 | .br |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 229 | 617920313939360a2e5c22204d616e2070616765 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 230 | .br |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 231 | 20617574686f723a0a2e5c2220202020546f6e79 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 232 | .br |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 233 | 204e7567656e74203c746f6e79407363746e7567 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 234 | .br |
| 235 | |
| 236 | .br |
| 237 | Hexdump the first 120 bytes of this man page with 12 octets per line. |
| 238 | .br |
| 239 | \fI% xxd \-l 120 \-c 12 xxd.1\fR |
| 240 | .br |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 241 | 0000000: 2e54 4820 5858 4420 3120 2241 .TH XXD 1 "A |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 242 | .br |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 243 | 000000c: 7567 7573 7420 3139 3936 2220 ugust 1996" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 244 | .br |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 245 | 0000018: 224d 616e 7561 6c20 7061 6765 "Manual page |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 246 | .br |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 247 | 0000024: 2066 6f72 2078 7864 220a 2e5c for xxd"..\\ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 248 | .br |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 249 | 0000030: 220a 2e5c 2220 3231 7374 204d "..\\" 21st M |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 250 | .br |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 251 | 000003c: 6179 2031 3939 360a 2e5c 2220 ay 1996..\\" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 252 | .br |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 253 | 0000048: 4d61 6e20 7061 6765 2061 7574 Man page aut |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 254 | .br |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 255 | 0000054: 686f 723a 0a2e 5c22 2020 2020 hor:..\\" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 256 | .br |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 257 | 0000060: 546f 6e79 204e 7567 656e 7420 Tony Nugent |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 258 | .br |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 259 | 000006c: 3c74 6f6e 7940 7363 746e 7567 <tony@sctnug |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 260 | .PP |
| 261 | .br |
| 262 | Display just the date from the file xxd.1 |
| 263 | .br |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 264 | \fI% xxd \-s 0x36 \-l 13 \-c 13 xxd.1\fR |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 265 | .br |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 266 | 0000036: 3231 7374 204d 6179 2031 3939 36 21st May 1996 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 267 | .PP |
| 268 | .br |
| 269 | Copy |
| 270 | .B input_file |
| 271 | to |
| 272 | .B output_file |
| 273 | and prepend 100 bytes of value 0x00. |
| 274 | .br |
Bram Moolenaar | 3991dab | 2006-03-27 17:01:56 +0000 | [diff] [blame] | 275 | \fI% xxd input_file | xxd \-r \-s 100 > output_file\fR |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 276 | .br |
| 277 | |
| 278 | .br |
| 279 | Patch the date in the file xxd.1 |
| 280 | .br |
Bram Moolenaar | 3991dab | 2006-03-27 17:01:56 +0000 | [diff] [blame] | 281 | \fI% echo "0000037: 3574 68" | xxd \-r \- xxd.1\fR |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 282 | .br |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 283 | \fI% xxd \-s 0x36 \-l 13 \-c 13 xxd.1\fR |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 284 | .br |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 285 | 0000036: 3235 7468 204d 6179 2031 3939 36 25th May 1996 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 286 | .PP |
| 287 | .br |
| 288 | Create a 65537 byte file with all bytes 0x00, |
| 289 | except for the last one which is 'A' (hex 0x41). |
| 290 | .br |
Bram Moolenaar | 3991dab | 2006-03-27 17:01:56 +0000 | [diff] [blame] | 291 | \fI% echo "010000: 41" | xxd \-r > file\fR |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 292 | .PP |
| 293 | .br |
| 294 | Hexdump this file with autoskip. |
| 295 | .br |
| 296 | \fI% xxd \-a \-c 12 file\fR |
| 297 | .br |
| 298 | 0000000: 0000 0000 0000 0000 0000 0000 ............ |
| 299 | .br |
| 300 | * |
| 301 | .br |
| 302 | 000fffc: 0000 0000 40 ....A |
| 303 | .PP |
| 304 | Create a 1 byte file containing a single 'A' character. |
| 305 | The number after '\-r \-s' adds to the linenumbers found in the file; |
| 306 | in effect, the leading bytes are suppressed. |
| 307 | .br |
Bram Moolenaar | 3991dab | 2006-03-27 17:01:56 +0000 | [diff] [blame] | 308 | \fI% echo "010000: 41" | xxd \-r \-s \-0x10000 > file\fR |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 309 | .PP |
| 310 | Use xxd as a filter within an editor such as |
| 311 | .B vim(1) |
| 312 | to hexdump a region marked between `a' and `z'. |
| 313 | .br |
| 314 | \fI:'a,'z!xxd\fR |
| 315 | .PP |
| 316 | Use xxd as a filter within an editor such as |
| 317 | .B vim(1) |
| 318 | to recover a binary hexdump marked between `a' and `z'. |
| 319 | .br |
| 320 | \fI:'a,'z!xxd \-r\fR |
| 321 | .PP |
| 322 | Use xxd as a filter within an editor such as |
| 323 | .B vim(1) |
| 324 | to recover one line of a hexdump. Move the cursor over the line and type: |
| 325 | .br |
| 326 | \fI!!xxd \-r\fR |
| 327 | .PP |
| 328 | Read single characters from a serial line |
| 329 | .br |
| 330 | \fI% xxd \-c1 < /dev/term/b &\fR |
| 331 | .br |
| 332 | \fI% stty < /dev/term/b \-echo \-opost \-isig \-icanon min 1\fR |
| 333 | .br |
| 334 | \fI% echo \-n foo > /dev/term/b\fR |
| 335 | .PP |
| 336 | .SH "RETURN VALUES" |
| 337 | The following error values are returned: |
| 338 | .TP |
| 339 | 0 |
| 340 | no errors encountered. |
| 341 | .TP |
| 342 | \-1 |
| 343 | operation not supported ( |
| 344 | .I xxd \-r \-i |
| 345 | still impossible). |
| 346 | .TP |
| 347 | 1 |
| 348 | error while parsing options. |
| 349 | .TP |
| 350 | 2 |
| 351 | problems with input file. |
| 352 | .TP |
| 353 | 3 |
| 354 | problems with output file. |
| 355 | .TP |
| 356 | 4,5 |
| 357 | desired seek position is unreachable. |
| 358 | .SH "SEE ALSO" |
| 359 | uuencode(1), uudecode(1), patch(1) |
| 360 | .br |
| 361 | .SH WARNINGS |
| 362 | The tools weirdness matches its creators brain. |
| 363 | Use entirely at your own risk. Copy files. Trace it. Become a wizard. |
| 364 | .br |
| 365 | .SH VERSION |
| 366 | This manual page documents xxd version 1.7 |
| 367 | .SH AUTHOR |
| 368 | .br |
| 369 | (c) 1990-1997 by Juergen Weigert |
| 370 | .br |
Bram Moolenaar | 3991dab | 2006-03-27 17:01:56 +0000 | [diff] [blame] | 371 | <jnweiger@informatik.uni\-erlangen.de> |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 372 | .LP |
| 373 | Distribute freely and credit me, |
| 374 | .br |
| 375 | make money and share with me, |
| 376 | .br |
| 377 | lose money and don't ask me. |
| 378 | .PP |
| 379 | Manual page started by Tony Nugent |
| 380 | .br |
| 381 | <tony@sctnugen.ppp.gu.edu.au> <T.Nugent@sct.gu.edu.au> |
| 382 | .br |
| 383 | Small changes by Bram Moolenaar. |
| 384 | Edited by Juergen Weigert. |
| 385 | .PP |