comparison runtime/doc/xxd.man @ 13571:362b27e3f702 v8.0.1658

patch 8.0.1658: capitalize argument not available in long form commit https://github.com/vim/vim/commit/79cf7c0d4574f15cfad5ad706f175e226c528f2a Author: Bram Moolenaar <Bram@vim.org> Date: Tue Apr 3 14:21:16 2018 +0200 patch 8.0.1658: capitalize argument not available in long form Problem: Capitalize argument not available in long form. Solution: Recognize -capitalize. Update man page.
author Christian Brabandt <cb@256bit.org>
date Tue, 03 Apr 2018 14:30:08 +0200
parents 2def7b25de60
children 2f854597399f
comparison
equal deleted inserted replaced
13570:d2b609a32753 13571:362b27e3f702
28 Spaces between a single option letter and its parameter are optional. 28 Spaces between a single option letter and its parameter are optional.
29 Parameters to options can be specified in decimal, hexadecimal or octal 29 Parameters to options can be specified in decimal, hexadecimal or octal
30 notation. Thus -c8, -c 8, -c 010 and -cols 8 are all equivalent. 30 notation. Thus -c8, -c 8, -c 010 and -cols 8 are all equivalent.
31 31
32 -a | -autoskip 32 -a | -autoskip
33 toggle autoskip: A single '*' replaces nul-lines. Default off. 33 Toggle autoskip: A single '*' replaces nul-lines. Default off.
34 34
35 -b | -bits 35 -b | -bits
36 Switch to bits (binary digits) dump, rather than hexdump. This 36 Switch to bits (binary digits) dump, rather than hexdump. This
37 option writes octets as eight digits "1"s and "0"s instead of a 37 option writes octets as eight digits "1"s and "0"s instead of a
38 normal hexadecimal dump. Each line is preceded by a line number 38 normal hexadecimal dump. Each line is preceded by a line number
39 in hexadecimal and followed by an ascii (or ebcdic) representa‐ 39 in hexadecimal and followed by an ascii (or ebcdic) representa‐
40 tion. The command line switches -r, -p, -i do not work with this 40 tion. The command line switches -r, -p, -i do not work with this
41 mode. 41 mode.
42 42
43 -c cols | -cols cols 43 -c cols | -cols cols
44 format <cols> octets per line. Default 16 (-i: 12, -ps: 30, -b: 44 Format <cols> octets per line. Default 16 (-i: 12, -ps: 30, -b:
45 6). Max 256. 45 6). Max 256.
46
47 -C | -capitalize
48 Capitalize variable names in C include file style, when using
49 -i.
46 50
47 -E | -EBCDIC 51 -E | -EBCDIC
48 Change the character encoding in the righthand column from ASCII 52 Change the character encoding in the righthand column from ASCII
49 to EBCDIC. This does not change the hexadecimal representation. 53 to EBCDIC. This does not change the hexadecimal representation.
50 The option is meaningless in combinations with -r, -p or -i. 54 The option is meaningless in combinations with -r, -p or -i.
51 55
52 -e Switch to little-endian hexdump. This option treats byte groups 56 -e Switch to little-endian hexdump. This option treats byte groups
53 as words in little-endian byte order. The default grouping of 4 57 as words in little-endian byte order. The default grouping of 4
54 bytes may be changed using -g. This option only applies to hex‐ 58 bytes may be changed using -g. This option only applies to hex‐
55 dump, leaving the ASCII (or EBCDIC) representation unchanged. 59 dump, leaving the ASCII (or EBCDIC) representation unchanged.
56 The command line switches -r, -p, -i do not work with this mode. 60 The command line switches -r, -p, -i do not work with this mode.
57 61
58 -g bytes | -groupsize bytes 62 -g bytes | -groupsize bytes
59 separate the output of every <bytes> bytes (two hex characters 63 Separate the output of every <bytes> bytes (two hex characters
60 or eight bit-digits each) by a whitespace. Specify -g 0 to sup‐ 64 or eight bit-digits each) by a whitespace. Specify -g 0 to sup‐
61 press grouping. <Bytes> defaults to 2 in normal mode, 4 in lit‐ 65 press grouping. <Bytes> defaults to 2 in normal mode, 4 in lit‐
62 tle-endian mode and 1 in bits mode. Grouping does not apply to 66 tle-endian mode and 1 in bits mode. Grouping does not apply to
63 postscript or include style. 67 postscript or include style.
64 68
65 -h | -help 69 -h | -help
66 print a summary of available commands and exit. No hex dumping 70 Print a summary of available commands and exit. No hex dumping
67 is performed. 71 is performed.
68 72
69 -i | -include 73 -i | -include
70 output in C include file style. A complete static array defini‐ 74 Output in C include file style. A complete static array defini‐
71 tion is written (named after the input file), unless xxd reads 75 tion is written (named after the input file), unless xxd reads
72 from stdin. 76 from stdin.
73 77
74 -l len | -len len 78 -l len | -len len
75 stop after writing <len> octets. 79 Stop after writing <len> octets.
76 80
77 -o offset 81 -o offset
78 add <offset> to the displayed file position. 82 Add <offset> to the displayed file position.
79 83
80 -p | -ps | -postscript | -plain 84 -p | -ps | -postscript | -plain
81 output in postscript continuous hexdump style. Also known as 85 Output in postscript continuous hexdump style. Also known as
82 plain hexdump style. 86 plain hexdump style.
83 87
84 -r | -revert 88 -r | -revert
85 reverse operation: convert (or patch) hexdump into binary. If 89 Reverse operation: convert (or patch) hexdump into binary. If
86 not writing to stdout, xxd writes into its output file without 90 not writing to stdout, xxd writes into its output file without
87 truncating it. Use the combination -r -p to read plain hexadeci‐ 91 truncating it. Use the combination -r -p to read plain hexadeci‐
88 mal dumps without line number information and without a particu‐ 92 mal dumps without line number information and without a particu‐
89 lar column layout. Additional Whitespace and line-breaks are 93 lar column layout. Additional Whitespace and line-breaks are
90 allowed anywhere. 94 allowed anywhere.
91 95
92 -seek offset 96 -seek offset
93 When used after -r: revert with <offset> added to file positions 97 When used after -r: revert with <offset> added to file positions
94 found in hexdump. 98 found in hexdump.
95 99
96 -s [+][-]seek 100 -s [+][-]seek
97 start at <seek> bytes abs. (or rel.) infile offset. + indicates 101 Start at <seek> bytes abs. (or rel.) infile offset. + indicates
98 that the seek is relative to the current stdin file position 102 that the seek is relative to the current stdin file position
99 (meaningless when not reading from stdin). - indicates that the 103 (meaningless when not reading from stdin). - indicates that the
100 seek should be that many characters from the end of the input 104 seek should be that many characters from the end of the input
101 (or if combined with +: before the current stdin file position). 105 (or if combined with +: before the current stdin file position).
102 Without -s option, xxd starts at the current file position. 106 Without -s option, xxd starts at the current file position.
103 107
104 -u use upper case hex letters. Default is lower case. 108 -u Use upper case hex letters. Default is lower case.
105 109
106 -v | -version 110 -v | -version
107 show version string. 111 Show version string.
108 112
109 CAVEATS 113 CAVEATS
110 xxd -r has some builtin magic while evaluating line number information. 114 xxd -r has some builtin magic while evaluating line number information.
111 If the output file is seekable, then the linenumbers at the start of 115 If the output file is seekable, then the linenumbers at the start of
112 each hexdump line may be out of order, lines may be missing, or over‐ 116 each hexdump line may be out of order, lines may be missing, or over‐
113 lapping. In these cases xxd will lseek(2) to the next position. If the 117 lapping. In these cases xxd will lseek(2) to the next position. If the
114 output file is not seekable, only gaps are allowed, which will be 118 output file is not seekable, only gaps are allowed, which will be
115 filled by null-bytes. 119 filled by null-bytes.
116 120
117 xxd -r never generates parse errors. Garbage is silently skipped. 121 xxd -r never generates parse errors. Garbage is silently skipped.
118 122
119 When editing hexdumps, please note that xxd -r skips everything on the 123 When editing hexdumps, please note that xxd -r skips everything on the
120 input line after reading enough columns of hexadecimal data (see option 124 input line after reading enough columns of hexadecimal data (see option
121 -c). This also means, that changes to the printable ascii (or ebcdic) 125 -c). This also means, that changes to the printable ascii (or ebcdic)
122 columns are always ignored. Reverting a plain (or postscript) style 126 columns are always ignored. Reverting a plain (or postscript) style
123 hexdump with xxd -r -p does not depend on the correct number of col‐ 127 hexdump with xxd -r -p does not depend on the correct number of col‐
124 umns. Here anything that looks like a pair of hex-digits is inter‐ 128 umns. Here anything that looks like a pair of hex-digits is inter‐
125 preted. 129 preted.
126 130
127 Note the difference between 131 Note the difference between
128 % xxd -i file 132 % xxd -i file
129 and 133 and
130 % xxd -i < file 134 % xxd -i < file
131 135
132 xxd -s +seek may be different from xxd -s seek, as lseek(2) is used to 136 xxd -s +seek may be different from xxd -s seek, as lseek(2) is used to
133 "rewind" input. A '+' makes a difference if the input source is stdin, 137 "rewind" input. A '+' makes a difference if the input source is stdin,
134 and if stdin's file position is not at the start of the file by the 138 and if stdin's file position is not at the start of the file by the
135 time xxd is started and given its input. The following examples may 139 time xxd is started and given its input. The following examples may
136 help to clarify (or further confuse!)... 140 help to clarify (or further confuse!)...
137 141
138 Rewind stdin before reading; needed because the `cat' has already read 142 Rewind stdin before reading; needed because the `cat' has already read
139 to the end of stdin. 143 to the end of stdin.
140 % sh -c "cat > plain_copy; xxd -s 0 > hex_copy" < file 144 % sh -c "cat > plain_copy; xxd -s 0 > hex_copy" < file
141 145
142 Hexdump from file position 0x480 (=1024+128) onwards. The `+' sign 146 Hexdump from file position 0x480 (=1024+128) onwards. The `+' sign
143 means "relative to the current position", thus the `128' adds to the 1k 147 means "relative to the current position", thus the `128' adds to the 1k
144 where dd left off. 148 where dd left off.
145 % sh -c "dd of=plain_snippet bs=1k count=1; xxd -s +128 > hex_snippet" 149 % sh -c "dd of=plain_snippet bs=1k count=1; xxd -s +128 > hex_snippet"
146 < file 150 < file
147 151
148 Hexdump from file position 0x100 ( = 1024-768) on. 152 Hexdump from file position 0x100 ( = 1024-768) on.
149 % sh -c "dd of=plain_snippet bs=1k count=1; xxd -s +-768 > hex_snippet" 153 % sh -c "dd of=plain_snippet bs=1k count=1; xxd -s +-768 > hex_snippet"
150 < file 154 < file
151 155
152 However, this is a rare situation and the use of `+' is rarely needed. 156 However, this is a rare situation and the use of `+' is rarely needed.
153 The author prefers to monitor the effect of xxd with strace(1) or 157 The author prefers to monitor the effect of xxd with strace(1) or
154 truss(1), whenever -s is used. 158 truss(1), whenever -s is used.
155 159
156 EXAMPLES 160 EXAMPLES
157 Print everything but the first three lines (hex 0x30 bytes) of file. 161 Print everything but the first three lines (hex 0x30 bytes) of file.
158 % xxd -s 0x30 file 162 % xxd -s 0x30 file
192 Patch the date in the file xxd.1 196 Patch the date in the file xxd.1
193 % echo "0000037: 3574 68" | xxd -r - xxd.1 197 % echo "0000037: 3574 68" | xxd -r - xxd.1
194 % xxd -s 0x36 -l 13 -c 13 xxd.1 198 % xxd -s 0x36 -l 13 -c 13 xxd.1
195 0000036: 3235 7468 204d 6179 2031 3939 36 25th May 1996 199 0000036: 3235 7468 204d 6179 2031 3939 36 25th May 1996
196 200
197 Create a 65537 byte file with all bytes 0x00, except for the last one 201 Create a 65537 byte file with all bytes 0x00, except for the last one
198 which is 'A' (hex 0x41). 202 which is 'A' (hex 0x41).
199 % echo "010000: 41" | xxd -r > file 203 % echo "010000: 41" | xxd -r > file
200 204
201 Hexdump this file with autoskip. 205 Hexdump this file with autoskip.
202 % xxd -a -c 12 file 206 % xxd -a -c 12 file
203 0000000: 0000 0000 0000 0000 0000 0000 ............ 207 0000000: 0000 0000 0000 0000 0000 0000 ............
204 * 208 *
205 000fffc: 0000 0000 40 ....A 209 000fffc: 0000 0000 40 ....A
206 210
207 Create a 1 byte file containing a single 'A' character. The number 211 Create a 1 byte file containing a single 'A' character. The number
208 after '-r -s' adds to the linenumbers found in the file; in effect, the 212 after '-r -s' adds to the linenumbers found in the file; in effect, the
209 leading bytes are suppressed. 213 leading bytes are suppressed.
210 % echo "010000: 41" | xxd -r -s -0x10000 > file 214 % echo "010000: 41" | xxd -r -s -0x10000 > file
211 215
212 Use xxd as a filter within an editor such as vim(1) to hexdump a region 216 Use xxd as a filter within an editor such as vim(1) to hexdump a region
243 247
244 SEE ALSO 248 SEE ALSO
245 uuencode(1), uudecode(1), patch(1) 249 uuencode(1), uudecode(1), patch(1)
246 250
247 WARNINGS 251 WARNINGS
248 The tools weirdness matches its creators brain. Use entirely at your 252 The tools weirdness matches its creators brain. Use entirely at your
249 own risk. Copy files. Trace it. Become a wizard. 253 own risk. Copy files. Trace it. Become a wizard.
250 254
251 VERSION 255 VERSION
252 This manual page documents xxd version 1.7 256 This manual page documents xxd version 1.7
253 257