Mercurial > docs > cut
annotate cut.en.ms @ 27:5cefcfc72d42
Added first version of the translation to English
author | markus schnalke <meillo@marmaro.de> |
---|---|
date | Tue, 04 Aug 2015 21:04:10 +0200 |
parents | |
children | 0d7329867dd1 |
rev | line source |
---|---|
27
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
1 .so macros |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
2 .lc_ctype en_US.utf8 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
3 .pl -4v |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
4 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
5 .TL |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
6 Cut out selected fields of each line of a file |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
7 .AU |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
8 markus schnalke <meillo@marmaro.de> |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
9 .. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
10 .FS |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
11 2015-05. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
12 This text is in the public domain (CC0). |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
13 It is available online: |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
14 .I http://marmaro.de/docs/ |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
15 .FE |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
16 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
17 .LP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
18 Cut is a classic program in the Unix toolchest. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
19 It is present in most tutorials on shell programming, because it |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
20 is such a nice and useful tool which good explanationary value. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
21 This text shall take a look behind its surface. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
22 .SH |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
23 Usage |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
24 .LP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
25 Initially, cut had two operation modes, which were amended by a |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
26 third one, later. Cut may cut specified characters out of the |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
27 input lines or it may cut out specified fields, which are defined |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
28 by a delimiting character. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
29 .PP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
30 The character mode is well suited to slice fixed-width input |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
31 formats into parts. One might, for instance, extract the access |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
32 rights from the output of \f(CWls -l\fP, here the rights of the |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
33 file's owner: |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
34 .CS |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
35 $ ls -l foo |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
36 -rw-rw-r-- 1 meillo users 0 May 12 07:32 foo |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
37 .sp .3 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
38 $ ls -l foo | cut -c 2-4 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
39 rw- |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
40 .CE |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
41 .LP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
42 Or the write permission for the owner, the group and the |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
43 world: |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
44 .CS |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
45 $ ls -l foo | cut -c 3,6,9 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
46 ww- |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
47 .CE |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
48 .LP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
49 Cut can also be used to shorten strings: |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
50 .CS |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
51 $ long=12345678901234567890 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
52 .sp .3 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
53 $ echo "$long" | cut -c -10 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
54 1234567890 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
55 .CE |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
56 .LP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
57 This command outputs no more than the first 10 characters of |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
58 \f(CW$long\fP. (Alternatively, on could use \f(CWprintf |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
59 "%.10s\\n" "$long"\fP for this job.) |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
60 .PP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
61 However, if it's not about displaying characters but about their |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
62 storing, then \f(CW-c\fP is only partly suited. In former times, |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
63 when US-ASCII had been the omnipresent character encoding, each |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
64 character was stored with exactly one byte. Therefore, \f(CWcut |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
65 -c\fP selected both, output characters and bytes, equally. With |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
66 the uprise of multi-byte encodings (like UTF-8), this assumption |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
67 became obsolete. Consequently, a byte mode (option \f(CW-b\fP) |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
68 was added to cut, with POSIX.2-1992. To select the first up to |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
69 500 bytes of each line (and ignore the rest), one can use: |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
70 .CS |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
71 $ cut -b -500 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
72 .CE |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
73 .LP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
74 The remainder can be caught with \f(CWcut -b 501-\fP. This |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
75 possibility is important for POSIX, because it allows to create |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
76 text files with limited line length |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
77 .[[ http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cut.html#tag_20_28_17 . |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
78 .PP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
79 Although the byte mode was newly introduced, it was meant to |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
80 behave exactly as the old character mode. The character mode, |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
81 however, had to be implemented differently. In consequence, |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
82 the problem wasn't to support the byte mode, but to support the |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
83 new character mode correctly. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
84 .PP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
85 Besides the character and byte modes, cut has the field mode, |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
86 which is activated by \f(CW-f\fP. It selects fields from the |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
87 input. The delimiting character (by default, the tab) may be |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
88 changed using \f(CW-d\fP. It applies to the input as well as to |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
89 the output. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
90 .PP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
91 The typical example for the use of cut's field mode is the |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
92 selection of information from the passwd file. Here, for |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
93 instance, the username and its uid: |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
94 .CS |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
95 $ cut -d: -f1,3 /etc/passwd |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
96 root:0 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
97 bin:1 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
98 daemon:2 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
99 mail:8 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
100 ... |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
101 .CE |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
102 .LP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
103 (The values to the command line switches may be appended directly |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
104 to them or separated by whitespace.) |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
105 .PP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
106 The field mode is suited for simple tabulary data, like the |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
107 passwd file. Beyond that, it soon reaches its limits. Especially, |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
108 the typical case of whitespace-separated fields is covered poorly |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
109 by it. Cut's delimiter is exactly one character, |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
110 therefore one may not split at both, space and tab characters. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
111 Furthermore, multiple adjacent delimiter characters lead to |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
112 empty fields. This is not the expected behavior for |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
113 the processing of whitespace-separated fields. Some |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
114 implementations, e.g. the one of FreeBSD, have extensions that |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
115 handle this case in the expected way. Apart from that, i.e. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
116 if one likes to stay portable, awk comes to rescue. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
117 .PP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
118 Awk provides another function that cut misses: Changing the order |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
119 of the fields in the output. For cut, the order of the field |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
120 selection specification is irrelevant; it doesn't even matter if |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
121 fields are given multiple times. Thus, the invocation |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
122 \f(CWcut -c 5-8,1,4-6\fP outputs the characters number |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
123 1, 4, 5, 6, 7 and 8 in exactly this order. The |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
124 selection is like in the mathematical set theory: Each |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
125 specified field is part of the solution set. The fields in the |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
126 solution set are always in the same order as in the input. To |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
127 speak with the words of the man page in Version 8 Unix: |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
128 ``In data base parlance, it projects a relation.'' |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
129 .[[ http://man.cat-v.org/unix_8th/1/cut |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
130 This means, cut applies the database operation \fIprojection\fP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
131 to the text input. Wikipedia explains it in the following way: |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
132 ``In practical terms, it can be roughly thought of as picking a |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
133 sub-set of all available columns.'' |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
134 .[[ https://en.wikipedia.org/wiki/Projection_(relational_algebra) |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
135 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
136 .SH |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
137 Historical Background |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
138 .LP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
139 Cut came to public life in 1982 with the release of UNIX System |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
140 III. Browsing through the sources of System III, one finds cut.c |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
141 with the timestamp 1980-04-11 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
142 .[[ http://minnie.tuhs.org/cgi-bin/utree.pl?file=SysIII/usr/src/cmd . |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
143 This is the oldest implementation of the program, I was able to |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
144 discover. However, the SCCS-ID in the source code speaks of |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
145 version 1.5. According to Doug McIlroy |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
146 .[[ http://minnie.tuhs.org/pipermail/tuhs/2015-May/004083.html , |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
147 the earlier history likely lays in PWB/UNIX, which was the |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
148 basis for System III. In the available sources of PWB 1.0 (1977) |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
149 .[[ http://minnie.tuhs.org/Archive/PDP-11/Distributions/usdl/ , |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
150 no cut is present. Of PWB 2.0, no sources or useful documentation |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
151 seem to be available. PWB 3.0 was later renamed to System III |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
152 for marketing purposes, hence it is identical to it. A side line |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
153 of PWB was CB UNIX, which was only used in the Bell Labs |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
154 internally. The manual of CB UNIX Edition 2.1 of November 1979 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
155 contains the earliest mentioning of cut, that my research brought |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
156 to light: A man page for it |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
157 .[[ ftp://sunsite.icm.edu.pl/pub/unix/UnixArchive/PDP-11/Distributions/other/CB_Unix/cbunix_man1_02.pdf . |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
158 .PP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
159 Now a look on BSD: There, my earliest discovery is a cut.c with |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
160 the file modification date of 1986-11-07 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
161 .[[ http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.3BSD-UWisc/src/usr.bin/cut |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
162 as part of the special version 4.3BSD-UWisc |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
163 .[[ http://gunkies.org/wiki/4.3_BSD_NFS_Wisconsin_Unix , |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
164 which was released in January 1987. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
165 This implementation is mostly identical to the one in System |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
166 III. The better known 4.3BSD-Tahoe (1988) does not contain cut. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
167 The following 4.3BSD-Reno (1990) does include cut. It is a freshly |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
168 written one by Adam S. Moskowitz and Marciano Pitargue, which was |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
169 included in BSD in 1989 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
170 .[[ http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.3BSD-Reno/src/usr.bin/cut . |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
171 Its man page |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
172 .[[ http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.3BSD-Reno/src/usr.bin/cut/cut.1 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
173 already mentions the expected compliance to POSIX.2. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
174 One should note that POSIX.2 was first published in |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
175 September 1992, about two years after the man page and the |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
176 program were written. Hence, the program must have been |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
177 implemented based on a draft version of the standard. A look into |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
178 the code confirms the assumption. The function to parse the field |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
179 selection includes the following comment: |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
180 .QP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
181 This parser is less restrictive than the Draft 9 POSIX spec. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
182 POSIX doesn't allow lists that aren't in increasing order or |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
183 overlapping lists. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
184 .LP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
185 Draft 11.2 of POSIX (1991-09) requires this flexibility already: |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
186 .QP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
187 The elements in list can be repeated, can overlap, and can |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
188 be specified in any order. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
189 .LP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
190 The same draft additionally includes all three operation modes, |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
191 whereas this early BSD cut only implemented the original two. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
192 Draft 9 might not have included the byte mode. Without access to |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
193 Draft 9 or 10, it wasn't possible to verify this guess. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
194 .PP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
195 The version numbers and change dates of the older BSD |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
196 implementations are manifested in the SCCS-IDs, which the |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
197 version control system of that time inserted. For instance |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
198 in 4.3BSD-Reno: ``5.3 (Berkeley) 6/24/90''. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
199 .PP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
200 The cut implementation of the GNU coreutils contains the |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
201 following copyright notice: |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
202 .CS |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
203 Copyright (C) 1997-2015 Free Software Foundation, Inc. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
204 Copyright (C) 1984 David M. Ihnat |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
205 .CE |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
206 .LP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
207 The code does have pretty old origins. Further comments show that |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
208 the source code was reworked by David MacKenzie first and later |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
209 by Jim Meyering, who put it into the version control system in |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
210 1992. It is unclear, why the years until 1997, at least from |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
211 1992 on, don't show up in the copyright notice. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
212 .PP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
213 Despite all those year numbers from the 80s, cut is a rather |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
214 young tool, at least in relation to the early Unix. Despite |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
215 being a decade older than Linux, the kernel, Unix had been |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
216 present for over ten years until cut appeared for the first |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
217 time. Most notably, cut wasn't part of Version 7 Unix, which |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
218 became the basis for all modern Unix systems. The more complex |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
219 tools sed and awk had been part of it already. Hence, the |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
220 question comes to mind, why cut was written at all, as there |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
221 existed two programs that were able to cover the use cases of |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
222 cut. On reason for cut surely was its compactness and the |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
223 resulting speed, in comparison to the then bulky awk. This lean |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
224 shape goes well with the Unix philosopy: Do one job and do it |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
225 well! Cut convinced. It found it's way to other Unix variants, |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
226 it became standardized and today it is present everywhere. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
227 .PP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
228 The original variant (without \f(CW-b\fP) was described by the |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
229 System V Interface Defintion, an important formal description |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
230 of UNIX System V, already in 1985. In the following years, it |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
231 appeared in all relevant standards. POSIX.2 in 1992 specified |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
232 cut for the first time in its modern form (with \f(CW-b\fP). |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
233 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
234 .SH |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
235 Multi-byte support |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
236 .LP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
237 The byte mode and thus the multi-byte support of |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
238 the POSIX character mode are standardized since 1992. But |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
239 how about their presence in the available implementations? |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
240 Which versions do implement POSIX correctly? |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
241 .PP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
242 The situation is divided in three parts: There are historic |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
243 implementations, which have only \f(CW-c\fP and \f(CW-f\fP. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
244 Then there are implementations, which have \f(CW-b\fP but |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
245 treat it as an alias for \f(CW-c\fP only. These |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
246 implementations work correctly for single-byte encodings |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
247 (e.g. US-ASCII, Latin1) but for multi-byte encodings (e.g. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
248 UTF-8) their \f(CW-c\fP behaves like \f(CW-b\fP (and |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
249 \f(CW-n\fP is ignored). Finally, there are implementations |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
250 that implement \f(CW-b\fP and \f(CW-c\fP POSIX-compliant. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
251 .PP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
252 Historic two-mode implementations are the ones of |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
253 System III, System V and the BSD ones until the mid-90s. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
254 .PP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
255 Pseudo multi-byte implementations are provided by GNU and |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
256 modern NetBSD and OpenBSD. The level of POSIX compliance |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
257 that is presented there is often higher than the level of |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
258 compliance that is actually provided. Sometimes it takes a |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
259 close look to discover that \f(CW-c\fP and \f(CW-n\fP don't |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
260 behave as expected. Some of the implementations take the |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
261 easy way by simply being ignorant to any multi-byte |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
262 encodings, at least they tell that clearly: |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
263 .QP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
264 Since we don't support multi-byte characters, the \f(CW-c\fP and \f(CW-b\fP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
265 options are equivalent, and the \f(CW-n\fP option is meaningless. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
266 .[[ http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/cut/cut.c?rev=1.18&content-type=text/x-cvsweb-markup |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
267 .LP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
268 Standard-adhering implementations, ones that treat |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
269 multi-byte characters correctly, are the one of the modern |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
270 FreeBSD and the one in the Heirloom toolchest. Tim Robbins |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
271 reimplemented the character mode of FreeBSD cut, |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
272 conforming to POSIX, in summer 2004 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
273 .[[ https://svnweb.freebsd.org/base?view=revision&revision=131194 . |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
274 The question, why the other BSD systems have not |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
275 integrated this change, is an open one. Maybe the answer an be |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
276 found in the above quoted statement. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
277 .PP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
278 How does a user find out if the cut on the own system handles |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
279 multi-byte characters correclty? First, one needs to check if |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
280 the system itself uses multi-byte characters, because otherwise |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
281 characters and bytes are equivalent and the question |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
282 is irrelevant. One can check this by looking at the locale |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
283 settings, but it is easier to print a typical multi-byte |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
284 character, for instance an Umlaut or the Euro currency |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
285 symbol, and check if one or more bytes are output: |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
286 .CS |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
287 $ echo ä | od -c |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
288 0000000 303 244 \\n |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
289 0000003 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
290 .CE |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
291 .LP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
292 In this case it were two bytes: octal 303 and 244. (The |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
293 Newline character is added by echo.) |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
294 .PP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
295 The program iconv converts text to specific encodings. This |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
296 is the output for Latin1 and UTF-8, for comparison: |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
297 .CS |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
298 $ echo ä | iconv -t latin1 | od -c |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
299 0000000 344 \\n |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
300 0000002 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
301 .sp .3 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
302 $ echo ä | iconv -t utf8 | od -c |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
303 0000000 303 244 \\n |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
304 0000003 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
305 .CE |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
306 .LP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
307 The output (without the iconv conversion) on many European |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
308 systems equals one of these two. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
309 .PP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
310 Now the test of the cut implementation. On a UTF-8 system, a |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
311 POSIX compliant implementation behaves as such: |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
312 .CS |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
313 $ echo ä | cut -c 1 | od -c |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
314 0000000 303 244 \\n |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
315 0000003 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
316 .sp .3 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
317 $ echo ä | cut -b 1 | od -c |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
318 0000000 303 \\n |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
319 0000002 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
320 .sp .3 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
321 $ echo ä | cut -b 1 -n | od -c |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
322 0000000 \\n |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
323 0000001 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
324 .CE |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
325 .LP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
326 A pseudo POSIX implementation, in contrast, behaves like the |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
327 middle one, for all three invocations: Only the first byte is |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
328 output. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
329 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
330 .SH |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
331 Implementations |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
332 .LP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
333 Let's take a look at the sources of a selection of |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
334 implementations. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
335 .PP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
336 A comparison of the amount of source code is good to get a first |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
337 impression. Typically, it grows through time. This can be seen |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
338 here, in general but not in all cases. A POSIX-compliant |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
339 implementation of the character mode requires more code, thus |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
340 these implementations are rather the larger ones. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
341 .TS |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
342 center; |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
343 r r r l l l. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
344 SLOC Lines Bytes Belongs to File tyime Category |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
345 _ |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
346 116 123 2966 System III 1980-04-11 historic |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
347 118 125 3038 4.3BSD-UWisc 1986-11-07 historic |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
348 200 256 5715 4.3BSD-Reno 1990-06-25 historic |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
349 200 270 6545 NetBSD 1993-03-21 historic |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
350 218 290 6892 OpenBSD 2008-06-27 pseudo-POSIX |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
351 224 296 6920 FreeBSD 1994-05-27 historic |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
352 232 306 7500 NetBSD 2014-02-03 pseudo-POSIX |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
353 340 405 7423 Heirloom 2012-05-20 POSIX |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
354 382 586 14175 GNU coreutils 1992-11-08 pseudo-POSIX |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
355 391 479 10961 FreeBSD 2012-11-24 POSIX |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
356 588 830 23167 GNU coreutils 2015-05-01 pseudo-POSIX |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
357 .TE |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
358 .LP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
359 Roughly four groups can be seen: (1) The two original |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
360 implementaions, which are mostly identical, with about 100 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
361 SLOC. (2) The five BSD versions, with about 200 SLOC. (3) The |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
362 two POSIX-compliant versions and the old GNU one, with a SLOC |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
363 count in the 300s. And finally (4) the modern GNU cut with |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
364 almost 600 SLOC. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
365 .PP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
366 The variation between the number of logical code |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
367 lines (SLOC, meassured with SLOCcount) and the number of |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
368 Newlines in the file (\f(CWwc -l\fP) spans between factor |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
369 1.06 for the oldest versions and factor 1.5 for GNU. The |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
370 largest influence on it are empty lines, pure comment lines |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
371 and the size of the license block at the beginning of the file. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
372 .PP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
373 Regarding the variation between logical code lines and the |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
374 file size (\f(CWwc -c\fP), the implementations span between |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
375 25 and 30 bytes per statement. With only 21 bytes per |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
376 statement, the Heirloom implementation marks the lower end; |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
377 the GNU implementation sets the upper limit at nearly 40. In |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
378 the case of GNU, the reason is mainly their coding style, with |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
379 special indent rules and long identifiers. Whether one finds |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
380 the Heirloom implementation |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
381 .[[ http://heirloom.cvs.sourceforge.net/viewvc/heirloom/heirloom/cut/cut.c?revision=1.6&view=markup |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
382 highly cryptic or exceptionally elegant, shall be left |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
383 open to the judgement of the reader. Especially the |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
384 comparison to the GNU implementation |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
385 .[[ http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob;f=src/cut.c;hb=e981643 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
386 is impressive. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
387 .PP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
388 The internal structure of the source code (in all cases it is |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
389 written in C) is mainly similar. Besides the mandatory main |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
390 function, which does the command line argument processing, |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
391 there usually exists a function to convert the field |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
392 selection specification to an internal data structure. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
393 Further more, almost all implementations have separate |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
394 functions for each of their operation modes. The POSIX-compliant |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
395 versions treat the \f(CW-b -n\fP combination as a separate |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
396 mode and thus implement it in an own function. Only the early |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
397 System III implementation (and its 4.3BSD-UWisc variant) do |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
398 everything, apart from error handling, in the main function. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
399 .PP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
400 Implementations of cut typically have two limiting aspects: |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
401 One being the maximum number of fields that can be handled, |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
402 the other being the maximum line length. On System III, both |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
403 numbers are limited to 512. 4.3BSD-Reno and the BSDs of the |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
404 90s have fixed limits as well (\f(CW_BSD_LINE_MAX\fP or |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
405 \f(CW_POSIX2_LINE_MAX\fP). Modern FreeBSD, NetBSD, all GNU |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
406 implementations and the Heirloom cut is able to handle |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
407 arbitrary numbers of fields and line lengths \(en the memory |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
408 is allocated dynamically. OpenBSD cut is a hybrid: It has a fixed |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
409 maximum number of fields, but allows arbitrary line lengths. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
410 The limited number of fields does, however, not appear to be |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
411 any practical problem, because \f(CW_POSIX2_LINE_MAX\fP is |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
412 guaranteed to be at least 2048 and is thus probably large enough. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
413 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
414 .SH |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
415 Descriptions |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
416 .LP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
417 Interesting, as well, is a comparison of the short descriptions |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
418 of cut, as can be found in the headlines of the man |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
419 pages or at the beginning of the source code files. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
420 The following list is roughly sorted by time and grouped by |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
421 decent: |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
422 .TS |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
423 center; |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
424 l l. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
425 CB UNIX cut out selected fields of each line of a file |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
426 System III cut out selected fields of each line of a file |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
427 System III \(dg cut and paste columns of a table (projection of a relation) |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
428 System V cut out selected fields of each line of a file |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
429 HP-UX cut out (extract) selected fields of each line of a file |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
430 .sp .3 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
431 4.3BSD-UWisc \(dg cut and paste columns of a table (projection of a relation) |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
432 4.3BSD-Reno select portions of each line of a file |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
433 NetBSD select portions of each line of a file |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
434 OpenBSD 4.6 select portions of each line of a file |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
435 FreeBSD 1.0 select portions of each line of a file |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
436 FreeBSD 10.0 cut out selected portions of each line of a file |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
437 SunOS 4.1.3 remove selected fields from each line of a file |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
438 SunOS 5.5.1 cut out selected fields of each line of a file |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
439 .sp .3 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
440 Heirloom Tools cut out selected fields of each line of a file |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
441 Heirloom Tools \(dg cut out fields of lines of files |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
442 .sp .3 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
443 GNU coreutils remove sections from each line of files |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
444 .sp .3 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
445 Minix select out columns of a file |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
446 .sp .3 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
447 Version 8 Unix rearrange columns of data |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
448 ``Unix Reader'' rearrange columns of text |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
449 .sp .3 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
450 POSIX cut out selected fields of each line of a file |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
451 .TE |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
452 .LP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
453 (The descriptions that are marked with `\(dg' were taken from |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
454 source code files. The POSIX entry contains the description |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
455 used in the standard. The ``Unix Reader'' is a retrospective |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
456 document by Doug McIlroy, which lists the availability of |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
457 tools in the Research Unix versions |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
458 .[[ http://doc.cat-v.org/unix/unix-reader/contents.pdf . |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
459 Its description should actually match the one in Version 8 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
460 Unix. The change could be a transfer mistake or a correction. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
461 All other descriptions originate from the various man pages.) |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
462 .PP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
463 Over time, the POSIX description was often adopted or it |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
464 served as inspiration. One such example is FreeBSD |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
465 .[[ https://svnweb.freebsd.org/base?view=revision&revision=167101 . |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
466 .PP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
467 It is noteworthy that the GNU coreutils in all versions |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
468 describe the performed action as a removal of parts of the |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
469 input, although the user clearly selects the parts that are |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
470 output. Probably the words ``cut out'' are too misleading. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
471 HP-UX concretized them. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
472 .PP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
473 There are also different terms used for the thing being |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
474 selected. Some talk about fields (POSIX), some talk |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
475 about portions (BSD) and some call it columns (Research |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
476 Unix). |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
477 .PP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
478 The seemingly least adequate description, the one of Version |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
479 8 Unix (``rearrange columns of data'') is explainable in so |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
480 far that the man page covers both, cut and paste, and in |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
481 their combination, columns can be rearranged. The use of |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
482 ``data'' instead of ``text'' might be a lapse, which McIlroy |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
483 corrected in his Unix Reader ... but, on the other hand, on |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
484 Unix, the two words are mostly synonymous, because all data |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
485 is text. |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
486 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
487 |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
488 .SH |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
489 Referenzen |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
490 .LP |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
491 .nf |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
492 ._r |
5cefcfc72d42
Added first version of the translation to English
markus schnalke <meillo@marmaro.de>
parents:
diff
changeset
|
493 |