1fmlcut(1F) FMLI Commands fmlcut(1F)
2
3
4
6 fmlcut - cut out selected fields of each line of a file
7
9 fmlcut -clist [filename]...
10
11
12 fmlcut -flist [-dchar] [-s] [filename]...
13
14
16 The fmlcut function cuts out columns from a table or fields from each
17 line in filename; in database parlance, it implements the projection of
18 a relation. fmlcut can be used as a filter; if filename is not speci‐
19 fied or is −, the standard input is read. list specifies the fields to
20 be selected. Fields can be fixed length (character positions) or vari‐
21 able length (separated by a field delimiter character), depending on
22 whether -c or -f is specified.
23
24
25 Note: Either the -c or the -f option must be specified.
26
28 list A comma-separated list of integer field numbers (in increas‐
29 ing order), with optional − to indicate ranges. For example:
30 1,4,7; 1−3,8; −5,10 (short for 1−5,10); or 3− (short for
31 third through last field).
32
33
34 -clist If -c is specified, list specifies character positions (for
35 instance, −c1−72 would pass the first 72 characters of each
36 line). Note: No space intervenes between -c and list.
37
38
39 -flist If -f is specified, list is a list of fields assumed to be
40 separated in the file by the default delimiter character,
41 TAB, or by char if the -d option is specified. For example,
42 −f1,7 copies the first and seventh field only. Lines with no
43 delimiter characters are passed through intact (useful for
44 table subheadings), unless -s is specified. Note: No space
45 intervenes between -f and list. The following options can be
46 used if you have specified -f.
47
48 -dchar If -d is specified, char is the field delimiter.
49 Space or other characters with special meaning to
50 FMLI must be quoted. Note: No space intervenes
51 between -d and char . The default field delimiter
52 is TAB.
53
54
55 -s Suppresses lines with no delimiter characters. If
56 -s is not specified, lines with no delimiters will
57 be passed through untouched.
58
59
60
62 Example 1 Getting login IDs and names
63
64
65 The following example gets the login IDs and names.
66
67
68 example% fmlcut -d: -f1,5 /etc/passwd
69
70
71
72 Example 2 Getting the current login name
73
74
75 The next example gets the current login name.
76
77
78 example% `who am i | fmlcut -f1 -d" "`
79
80
81
83 See attributes(5) for descriptions of the following attributes:
84
85
86
87
88 ┌─────────────────────────────┬─────────────────────────────┐
89 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
90 ├─────────────────────────────┼─────────────────────────────┤
91 │Availability │SUNWcsu │
92 └─────────────────────────────┴─────────────────────────────┘
93
95 fmlgrep(1F), attributes(5)
96
98 fmlcut returns the following exit values:
99
100 0 when the selected field is successfully cut out
101
102
103 2 on syntax errors
104
105
106
107 The following error messages may be displayed on the FMLI message line:
108
109 ERROR: line too long
110
111 A line has more than 1023 characters or fields, or there is no new-
112 line character.
113
114
115 ERROR: bad list for c/f option
116
117 Missing -c or -f option or incorrectly specified list. No error
118 occurs if a line has fewer fields than the list calls for.
119
120
121 ERROR: no fields
122
123 The list is empty.
124
125
126 ERROR: no delimiter
127
128 Missing char on -d option.
129
130
132 fmlcut cannot correctly process lines longer than 1023 characters, or
133 lines with no newline character.
134
135
136
137SunOS 5.11 5 Jul 1990 fmlcut(1F)