Commit | Line | Data |
---|---|---|
32424d04 C |
1 | DD(1) BSD Reference Manual DD(1) |
2 | ||
3 | N\bNA\bAM\bME\bE | |
4 | d\bdd\bd - convert and copy a file | |
5 | ||
6 | S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS | |
7 | d\bdd\bd [operands ...] | |
8 | ||
9 | D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN | |
10 | The d\bdd\bd utility copies the standard input to the standard output. Input | |
11 | data is read and written in 512-byte blocks. If input reads are short, | |
12 | input from multiple reads are aggregated to form the output block. When | |
13 | finished, d\bdd\bd displays the number of complete and partial input and output | |
14 | blocks and truncated input records to the standard error output. | |
15 | ||
16 | The following operands are available: | |
17 | ||
18 | b\bbs\bs=\b=_\bn Set both input and output block size, superseding the i\bib\bbs\bs and | |
19 | o\bob\bbs\bs operands. If no conversion values other than n\bno\boe\ber\brr\bro\bor\br, | |
20 | n\bno\bot\btr\bru\bun\bnc\bc or s\bsy\byn\bnc\bc are specified, then each input block is copied | |
21 | to the output as a single block without any aggregation of short | |
22 | blocks. | |
23 | ||
24 | c\bcb\bbs\bs=\b=_\bn Set the conversion record size to _\bn bytes. The conversion | |
25 | record size is required by the record oriented conversion val- | |
26 | ues. | |
27 | ||
28 | c\bco\bou\bun\bnt\bt=\b=_\bn Copy only _\bn input blocks. | |
29 | ||
30 | f\bfi\bil\ble\bes\bs=\b=_\bn Copy _\bn input files before terminating. This operand is only ap- | |
31 | plicable when the input device is a tape. | |
32 | ||
33 | i\bib\bbs\bs=\b=_\bn Set the input block size to _\bn bytes instead of the default 512. | |
34 | ||
35 | i\bif\bf=\b=_\bf_\bi_\bl_\be Read input from _\bf_\bi_\bl_\be instead of the standard input. | |
36 | ||
37 | o\bob\bbs\bs=\b=_\bn Set the output block size to _\bn bytes instead of the default 512. | |
38 | ||
39 | o\bof\bf=\b=_\bf_\bi_\bl_\be Write output to _\bf_\bi_\bl_\be instead of the standard output. Any regu- | |
40 | lar output file is truncated unless the n\bno\bot\btr\bru\bun\bnc\bc conversion value | |
41 | is specified. If an initial portion of the output file is | |
42 | skipped (see the s\bse\bee\bek\bk operand) the output file is truncated at | |
43 | that point. | |
44 | ||
45 | s\bse\bee\bek\bk=\b=_\bn Seek _\bn blocks from the beginning of the output before copying. | |
46 | On non-tape devices, a lseek(2) operation is used. Otherwise, | |
47 | existing blocks are read and the data discarded. If the user | |
48 | does not have read permission for the tape, it is positioned us- | |
49 | ing the tape ioctl(2) function calls. If the seek operation is | |
50 | past the end of file, space from the current end of file to the | |
51 | specified offset is filled with blocks of NUL bytes. | |
52 | ||
53 | s\bsk\bki\bip\bp=\b=_\bn Skip _\bn blocks from the beginning of the input before copying. | |
54 | On input which supports seeks, a lseek(2) operation is used. | |
55 | Otherwise, input data is read and discarded. For pipes, the | |
56 | correct number of bytes is read. For all other devices, the | |
57 | correct number of blocks is read without distinguishing between | |
58 | a partial or complete block being read. | |
59 | ||
60 | c\bco\bon\bnv\bv=\b= v\bva\bal\blu\bue\be[, v\bva\bal\blu\bue\be .\b..\b..\b.] | |
61 | Where v\bva\bal\blu\bue\be is one of the symbols from the following list. | |
62 | ||
63 | a\bas\bsc\bci\bii\bi, o\bol\bld\bda\bas\bsc\bci\bii\bi | |
64 | The same as the u\bun\bnb\bbl\blo\boc\bck\bk value except that characters | |
65 | are translated from ECBDIC to ASCII before the records | |
66 | are converted. (These values imply u\bun\bnb\bbl\blo\boc\bck\bk if the | |
67 | operand c\bcb\bbs\bs is also specified.) There are two conver- | |
68 | sion maps for ASCII. The value a\bas\bsc\bci\bii\bi specifies the rec- | |
69 | ommended one which is compatible with System V. The | |
70 | value o\bol\bld\bda\bas\bsc\bci\bii\bi specifies the one used in historic AT&T | |
71 | and pre-4.3BSD-reno systems. | |
72 | ||
73 | b\bbl\blo\boc\bck\bk Treats the input as a sequence of newline or end-of- | |
74 | file terminated variable length records independent of | |
75 | input and output block boundaries. Any trailing new- | |
76 | line character is discarded. Each input record is con- | |
77 | verted to a fixed length output record where the length | |
78 | is specified by the c\bcb\bbs\bs operand. Input records shorter | |
79 | than the conversion record size are padded with spaces. | |
80 | Input records longer than the conversion record size | |
81 | are truncated. The number of truncated input records, | |
82 | if any, are reported to the standard error output at | |
83 | the completion of the copy. | |
84 | ||
85 | e\beb\bbc\bcd\bdi\bic\bc, i\bib\bbm\bm, o\bol\bld\bde\beb\bbc\bcd\bdi\bic\bc, o\bol\bld\bdi\bib\bbm\bm | |
86 | The same as the b\bbl\blo\boc\bck\bk value except that characters are | |
87 | translated from ASCII to EBCDIC after the records are | |
88 | converted. (These values imply b\bbl\blo\boc\bck\bk if the operand | |
89 | c\bcb\bbs\bs is also specified.) There are four conversion maps | |
90 | for EBCDIC. The value e\beb\bbc\bcd\bdi\bic\bc specifies the recommended | |
91 | one which is compatible with AT&T System V UNIX. The | |
92 | value i\bib\bbm\bm is a slightly different mapping, which is | |
93 | compatible with the AT&T System V UNIX i\bib\bbm\bm value. The | |
94 | values o\bol\bld\bde\beb\bbc\bcd\bdi\bic\bc and o\bol\bld\bdi\bib\bbm\bm are maps used in historic | |
95 | AT&T and pre-4.3BSD-reno systems. | |
96 | ||
97 | l\blc\bca\bas\bse\be Transform uppercase characters into lowercase charac- | |
98 | ters. | |
99 | ||
100 | n\bno\boe\ber\brr\bro\bor\br Do not stop processing on an input error. When an in- | |
101 | put error occurs, a diagnostic message followed by the | |
102 | current input and output block counts will be written | |
103 | to the standard error output in the same format as the | |
104 | standard completion message. If the s\bsy\byn\bnc\bc conversion is | |
105 | also specified, any missing input data will be replaced | |
106 | with NUL bytes (or with spaces if a block oriented con- | |
107 | version value was specified) and processed as a normal | |
108 | input buffer. If the s\bsy\byn\bnc\bc conversion is not specified, | |
109 | the input block is omitted from the output. On input | |
110 | files which are not tapes or pipes, the file offset | |
111 | will be positioned past the block in which the error | |
112 | occurred using lseek(2). | |
113 | ||
114 | n\bno\bot\btr\bru\bun\bnc\bc Do not truncate the output file. This will preserve | |
115 | any blocks in the output file not explicitly written by | |
116 | d\bdd\bd. The n\bno\bot\btr\bru\bun\bnc\bc value is not supported for tapes. | |
117 | ||
118 | o\bos\bsy\byn\bnc\bc Pad the final output block to the full output block | |
119 | size. If the input file is not a multiple of the out- | |
120 | put block size after conversion, this conversion forces | |
121 | the final output block to be the same size as preceding | |
122 | blocks for use on devices that require regularly sized | |
123 | blocks to be written. This option is incompatible with | |
124 | use of the b\bbs\bs=\b=_\bn block size specification. | |
125 | ||
126 | s\bsw\bwa\bab\bb Swap every pair of input bytes. If an input buffer has | |
127 | an odd number of bytes, the last byte will be ignored | |
128 | during swapping. | |
129 | ||
130 | s\bsy\byn\bnc\bc Pad every input block to the input buffer size. Spaces | |
131 | are used for pad bytes if a block oriented conversion | |
132 | ||
133 | value is specified, otherwise NUL bytes are used. | |
134 | ||
135 | u\buc\bca\bas\bse\be Transform lowercase characters into uppercase charac- | |
136 | ters. | |
137 | ||
138 | u\bun\bnb\bbl\blo\boc\bck\bk Treats the input as a sequence of fixed length records | |
139 | independent of input and output block boundaries. The | |
140 | length of the input records is specified by the c\bcb\bbs\bs | |
141 | operand. Any trailing space characters are discarded | |
142 | and a newline character is appended. | |
143 | ||
144 | Where sizes are specified, a decimal number of bytes is expected. If the | |
145 | number ends with a ``b'', ``k'', ``m'' or ``w'', the number is multiplied | |
146 | by 512, 1024 (1K), 1048576 (1M) or the number of bytes in an integer, re- | |
147 | spectively. Two or more numbers may be separated by an ``x'' to indicate | |
148 | a product. | |
149 | ||
150 | When finished, d\bdd\bd displays the number of complete and partial input and | |
151 | output blocks, truncated input records and odd-length byte-swapping | |
152 | blocks to the standard error output. A partial input block is one where | |
153 | less than the input block size was read. A partial output block is one | |
154 | where less than the output block size was written. Partial output blocks | |
155 | to tape devices are considered fatal errors. Otherwise, the rest of the | |
156 | block will be written. Partial output blocks to character devices will | |
157 | produce a warning message. A truncated input block is one where a vari- | |
158 | able length record oriented conversion value was specified and the input | |
159 | line was too long to fit in the conversion record or was not newline ter- | |
160 | minated. | |
161 | ||
162 | Normally, data resulting from input or conversion or both are aggregated | |
163 | into output blocks of the specified size. After the end of input is | |
164 | reached, any remaining output is written as a block. This means that the | |
165 | final output block may be shorter than the output block size. | |
166 | ||
167 | If d\bdd\bd receives a SIGINFO (see the ``status'' argument for stty(1)) sig- | |
168 | nal, the current input and output block counts will be written to the | |
169 | standard error output in the same format as the standard completion mes- | |
170 | sage. If d\bdd\bd receives a SIGINT signal, the current input and output block | |
171 | counts will be written to the standard error output in the same format as | |
172 | the standard completion message and d\bdd\bd will exit. | |
173 | ||
174 | The d\bdd\bd utility exits 0 on success and >0 if an error occurred. | |
175 | ||
176 | S\bSE\bEE\bE A\bAL\bLS\bSO\bO | |
177 | cp(1), mt(1), tr(1) | |
178 | ||
179 | S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS | |
180 | The d\bdd\bd utility is expected to be a superset of the IEEE Std1003.2 | |
181 | (``POSIX'') standard. The f\bfi\bil\ble\bes\bs operand and the a\bas\bsc\bci\bii\bi, e\beb\bbc\bcd\bdi\bic\bc, i\bib\bbm\bm, | |
182 | o\bol\bld\bda\bas\bsc\bci\bii\bi, o\bol\bld\bde\beb\bbc\bcd\bdi\bic\bc and o\bol\bld\bdi\bib\bbm\bm values are extensions to the POSIX stan- | |
183 | dard. | |
184 | ||
185 | 4.4BSD January 13, 1994 3 |