annotate runtime/doc/xxd.man @ 32250:b1ea62e14b3c v9.0.1456

patch 9.0.1456: shortmess test depends on order of test execution Commit: https://github.com/vim/vim/commit/657b31fa3bda2089fef18c30fc706abe5d57e865 Author: zeertzjq <zeertzjq@outlook.com> Date: Sat Apr 15 21:28:02 2023 +0100 patch 9.0.1456: shortmess test depends on order of test execution Problem: Shortmess test depends on order of test execution. Solution: Clear messages. (closes https://github.com/vim/vim/issues/12264)
author Bram Moolenaar <Bram@vim.org>
date Sat, 15 Apr 2023 22:30:03 +0200
parents 912224cab37f
children 56d291e65044
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6918
2def7b25de60 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1126
diff changeset
1 XXD(1) General Commands Manual XXD(1)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 NAME
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 xxd - make a hexdump or do the reverse.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 SYNOPSIS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 xxd -h[elp]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 xxd [options] [infile [outfile]]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 xxd -r[evert] [options] [infile [outfile]]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 DESCRIPTION
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
14 xxd creates a hex dump of a given file or standard input. It can also
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
15 convert a hex dump back to its original binary form. Like uuencode(1)
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
16 and uudecode(1) it allows the transmission of binary data in a `mail-
6918
2def7b25de60 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1126
diff changeset
17 safe' ASCII representation, but has the advantage of decoding to stan‐
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
18 dard output. Moreover, it can be used to perform binary file patching.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 OPTIONS
6918
2def7b25de60 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1126
diff changeset
21 If no infile is given, standard input is read. If infile is specified
2def7b25de60 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1126
diff changeset
22 as a `-' character, then input is taken from standard input. If no
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
23 outfile is given (or a `-' character is in its place), results are sent
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
24 to standard output.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25
6918
2def7b25de60 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1126
diff changeset
26 Note that a "lazy" parser is used which does not check for more than
2def7b25de60 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1126
diff changeset
27 the first option letter, unless the option is followed by a parameter.
2def7b25de60 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1126
diff changeset
28 Spaces between a single option letter and its parameter are optional.
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
29 Parameters to options can be specified in decimal, hexadecimal or octal
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
30 notation. Thus -c8, -c 8, -c 010 and -cols 8 are all equivalent.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 -a | -autoskip
13571
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
33 Toggle autoskip: A single '*' replaces nul-lines. Default off.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 -b | -bits
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
36 Switch to bits (binary digits) dump, rather than hexdump. This
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
37 option writes octets as eight digits "1"s and "0"s instead of a
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
38 normal hexadecimal dump. Each line is preceded by a line number
6918
2def7b25de60 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1126
diff changeset
39 in hexadecimal and followed by an ascii (or ebcdic) representa‐
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
40 tion. The command line switches -r, -p, -i do not work with this
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
41 mode.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 -c cols | -cols cols
13571
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
44 Format <cols> octets per line. Default 16 (-i: 12, -ps: 30, -b:
27118
2f854597399f patch 8.2.4088: xxd cannot output everything in one line
Bram Moolenaar <Bram@vim.org>
parents: 13571
diff changeset
45 6). Max 256. No maxmimum for -ps. With -ps, 0 results in one
2f854597399f patch 8.2.4088: xxd cannot output everything in one line
Bram Moolenaar <Bram@vim.org>
parents: 13571
diff changeset
46 long line of output.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47
13571
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
48 -C | -capitalize
29352
912224cab37f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
49 Capitalize variable names in C include file style, when using
13571
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
50 -i.
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
51
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 -E | -EBCDIC
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
53 Change the character encoding in the righthand column from ASCII
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
54 to EBCDIC. This does not change the hexadecimal representation.
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
55 The option is meaningless in combinations with -r, -p or -i.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56
6918
2def7b25de60 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1126
diff changeset
57 -e Switch to little-endian hexdump. This option treats byte groups
2def7b25de60 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1126
diff changeset
58 as words in little-endian byte order. The default grouping of 4
2def7b25de60 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1126
diff changeset
59 bytes may be changed using -g. This option only applies to hex‐
29352
912224cab37f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
60 dump, leaving the ASCII (or EBCDIC) representation unchanged.
6918
2def7b25de60 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1126
diff changeset
61 The command line switches -r, -p, -i do not work with this mode.
2def7b25de60 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1126
diff changeset
62
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 -g bytes | -groupsize bytes
29352
912224cab37f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
64 Separate the output of every <bytes> bytes (two hex characters
6918
2def7b25de60 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1126
diff changeset
65 or eight bit-digits each) by a whitespace. Specify -g 0 to sup‐
2def7b25de60 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1126
diff changeset
66 press grouping. <Bytes> defaults to 2 in normal mode, 4 in lit‐
29352
912224cab37f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
67 tle-endian mode and 1 in bits mode. Grouping does not apply to
6918
2def7b25de60 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1126
diff changeset
68 postscript or include style.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 -h | -help
29352
912224cab37f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
71 Print a summary of available commands and exit. No hex dumping
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
72 is performed.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 -i | -include
29352
912224cab37f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
75 Output in C include file style. A complete static array defini‐
912224cab37f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
76 tion is written (named after the input file), unless xxd reads
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
77 from stdin.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 -l len | -len len
13571
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
80 Stop after writing <len> octets.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81
29352
912224cab37f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
82 -n name | -name name
912224cab37f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
83 Override the variable name output when -i is used. The array is
912224cab37f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
84 named name and the length is named name_len.
912224cab37f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
85
6918
2def7b25de60 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1126
diff changeset
86 -o offset
13571
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
87 Add <offset> to the displayed file position.
6918
2def7b25de60 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1126
diff changeset
88
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 -p | -ps | -postscript | -plain
13571
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
90 Output in postscript continuous hexdump style. Also known as
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
91 plain hexdump style.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 -r | -revert
13571
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
94 Reverse operation: convert (or patch) hexdump into binary. If
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
95 not writing to stdout, xxd writes into its output file without
6918
2def7b25de60 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1126
diff changeset
96 truncating it. Use the combination -r -p to read plain hexadeci‐
2def7b25de60 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1126
diff changeset
97 mal dumps without line number information and without a particu‐
29352
912224cab37f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
98 lar column layout. Additional Whitespace and line-breaks are al‐
912224cab37f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
99 lowed anywhere.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 -seek offset
218
0d6554dfc71e updated for version 7.0061
vimboss
parents: 36
diff changeset
102 When used after -r: revert with <offset> added to file positions
0d6554dfc71e updated for version 7.0061
vimboss
parents: 36
diff changeset
103 found in hexdump.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 -s [+][-]seek
13571
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
106 Start at <seek> bytes abs. (or rel.) infile offset. + indicates
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
107 that the seek is relative to the current stdin file position
1126
c5c164b4c95c updated for version 7.1a
vimboss
parents: 810
diff changeset
108 (meaningless when not reading from stdin). - indicates that the
13571
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
109 seek should be that many characters from the end of the input
1126
c5c164b4c95c updated for version 7.1a
vimboss
parents: 810
diff changeset
110 (or if combined with +: before the current stdin file position).
c5c164b4c95c updated for version 7.1a
vimboss
parents: 810
diff changeset
111 Without -s option, xxd starts at the current file position.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112
13571
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
113 -u Use upper case hex letters. Default is lower case.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 -v | -version
13571
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
116 Show version string.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
118 CAVEATS
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
119 xxd -r has some builtin magic while evaluating line number information.
13571
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
120 If the output file is seekable, then the linenumbers at the start of
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
121 each hexdump line may be out of order, lines may be missing, or over‐
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
122 lapping. In these cases xxd will lseek(2) to the next position. If the
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
123 output file is not seekable, only gaps are allowed, which will be
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
124 filled by null-bytes.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
126 xxd -r never generates parse errors. Garbage is silently skipped.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127
13571
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
128 When editing hexdumps, please note that xxd -r skips everything on the
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
129 input line after reading enough columns of hexadecimal data (see option
13571
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
130 -c). This also means, that changes to the printable ascii (or ebcdic)
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
131 columns are always ignored. Reverting a plain (or postscript) style
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
132 hexdump with xxd -r -p does not depend on the correct number of col‐
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
133 umns. Here anything that looks like a pair of hex-digits is inter‐
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
134 preted.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 Note the difference between
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 % xxd -i file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 % xxd -i < file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140
13571
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
141 xxd -s +seek may be different from xxd -s seek, as lseek(2) is used to
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
142 "rewind" input. A '+' makes a difference if the input source is stdin,
13571
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
143 and if stdin's file position is not at the start of the file by the
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
144 time xxd is started and given its input. The following examples may
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
145 help to clarify (or further confuse!)...
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146
13571
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
147 Rewind stdin before reading; needed because the `cat' has already read
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
148 to the end of stdin.
810
9f345c48220b updated for version 7.0c
vimboss
parents: 218
diff changeset
149 % sh -c "cat > plain_copy; xxd -s 0 > hex_copy" < file
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150
13571
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
151 Hexdump from file position 0x480 (=1024+128) onwards. The `+' sign
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
152 means "relative to the current position", thus the `128' adds to the 1k
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
153 where dd left off.
13571
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
154 % sh -c "dd of=plain_snippet bs=1k count=1; xxd -s +128 > hex_snippet"
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
155 < file
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 Hexdump from file position 0x100 ( = 1024-768) on.
810
9f345c48220b updated for version 7.0c
vimboss
parents: 218
diff changeset
158 % sh -c "dd of=plain_snippet bs=1k count=1; xxd -s +-768 > hex_snippet"
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
159 < file
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160
13571
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
161 However, this is a rare situation and the use of `+' is rarely needed.
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
162 The author prefers to monitor the effect of xxd with strace(1) or
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
163 truss(1), whenever -s is used.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 EXAMPLES
810
9f345c48220b updated for version 7.0c
vimboss
parents: 218
diff changeset
166 Print everything but the first three lines (hex 0x30 bytes) of file.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 % xxd -s 0x30 file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168
810
9f345c48220b updated for version 7.0c
vimboss
parents: 218
diff changeset
169 Print 3 lines (hex 0x30 bytes) from the end of file.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 % xxd -s -0x30 file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171
1126
c5c164b4c95c updated for version 7.1a
vimboss
parents: 810
diff changeset
172 Print 120 bytes as continuous hexdump with 20 octets per line.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 % xxd -l 120 -ps -c 20 xxd.1
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
174 2e54482058584420312022417567757374203139
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
175 39362220224d616e75616c207061676520666f72
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
176 20787864220a2e5c220a2e5c222032317374204d
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
177 617920313939360a2e5c22204d616e2070616765
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
178 20617574686f723a0a2e5c2220202020546f6e79
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
179 204e7567656e74203c746f6e79407363746e7567
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
181 Hexdump the first 120 bytes of this man page with 12 octets per line.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 % xxd -l 120 -c 12 xxd.1
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
183 0000000: 2e54 4820 5858 4420 3120 2241 .TH XXD 1 "A
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
184 000000c: 7567 7573 7420 3139 3936 2220 ugust 1996"
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
185 0000018: 224d 616e 7561 6c20 7061 6765 "Manual page
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
186 0000024: 2066 6f72 2078 7864 220a 2e5c for xxd"..\
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
187 0000030: 220a 2e5c 2220 3231 7374 204d "..\" 21st M
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
188 000003c: 6179 2031 3939 360a 2e5c 2220 ay 1996..\"
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
189 0000048: 4d61 6e20 7061 6765 2061 7574 Man page aut
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
190 0000054: 686f 723a 0a2e 5c22 2020 2020 hor:..\"
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
191 0000060: 546f 6e79 204e 7567 656e 7420 Tony Nugent
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
192 000006c: 3c74 6f6e 7940 7363 746e 7567 <tony@sctnug
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 Display just the date from the file xxd.1
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
195 % xxd -s 0x36 -l 13 -c 13 xxd.1
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
196 0000036: 3231 7374 204d 6179 2031 3939 36 21st May 1996
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
198 Copy input_file to output_file and prepend 100 bytes of value 0x00.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 % xxd input_file | xxd -r -s 100 > output_file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 Patch the date in the file xxd.1
810
9f345c48220b updated for version 7.0c
vimboss
parents: 218
diff changeset
202 % echo "0000037: 3574 68" | xxd -r - xxd.1
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
203 % xxd -s 0x36 -l 13 -c 13 xxd.1
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
204 0000036: 3235 7468 204d 6179 2031 3939 36 25th May 1996
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205
13571
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
206 Create a 65537 byte file with all bytes 0x00, except for the last one
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
207 which is 'A' (hex 0x41).
810
9f345c48220b updated for version 7.0c
vimboss
parents: 218
diff changeset
208 % echo "010000: 41" | xxd -r > file
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 Hexdump this file with autoskip.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 % xxd -a -c 12 file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 0000000: 0000 0000 0000 0000 0000 0000 ............
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 000fffc: 0000 0000 40 ....A
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215
29352
912224cab37f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
216 Create a 1 byte file containing a single 'A' character. The number af‐
912224cab37f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
217 ter '-r -s' adds to the linenumbers found in the file; in effect, the
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
218 leading bytes are suppressed.
810
9f345c48220b updated for version 7.0c
vimboss
parents: 218
diff changeset
219 % echo "010000: 41" | xxd -r -s -0x10000 > file
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
221 Use xxd as a filter within an editor such as vim(1) to hexdump a region
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
222 marked between `a' and `z'.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 :'a,'z!xxd
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
225 Use xxd as a filter within an editor such as vim(1) to recover a binary
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
226 hexdump marked between `a' and `z'.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 :'a,'z!xxd -r
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
229 Use xxd as a filter within an editor such as vim(1) to recover one line
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
230 of a hexdump. Move the cursor over the line and type:
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 !!xxd -r
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233 Read single characters from a serial line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 % xxd -c1 < /dev/term/b &
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 % stty < /dev/term/b -echo -opost -isig -icanon min 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 % echo -n foo > /dev/term/b
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 RETURN VALUES
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 The following error values are returned:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 0 no errors encountered.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
243 -1 operation not supported ( xxd -r -i still impossible).
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 1 error while parsing options.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247 2 problems with input file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 3 problems with output file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 4,5 desired seek position is unreachable.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 SEE ALSO
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 uuencode(1), uudecode(1), patch(1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 WARNINGS
13571
362b27e3f702 patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents: 6918
diff changeset
257 The tools weirdness matches its creators brain. Use entirely at your
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
258 own risk. Copy files. Trace it. Become a wizard.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 VERSION
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 This manual page documents xxd version 1.7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 AUTHOR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 (c) 1990-1997 by Juergen Weigert
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265 <jnweiger@informatik.uni-erlangen.de>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 Distribute freely and credit me,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 make money and share with me,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269 lose money and don't ask me.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 Manual page started by Tony Nugent
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 <tony@sctnugen.ppp.gu.edu.au> <T.Nugent@sct.gu.edu.au>
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
273 Small changes by Bram Moolenaar. Edited by Juergen Weigert.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
275 Manual page for xxd August 1996 XXD(1)