annotate runtime/doc/xxd.1 @ 8372:ce791ff9e0da v7.4.1478

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