1newform(1) User Commands newform(1)
2
3
4
6 newform - change the format of a text file
7
9 newform [-s] [-itabspec] [-otabspec] [-bn] [-en] [-pn]
10 [-an] [-f] [-cchar] [-ln] [filename]...
11
12
14 newform reads lines from the named filenames, or the standard input if
15 no input file is named, and reproduces the lines on the standard out‐
16 put. Lines are reformatted in accordance with command line options in
17 effect.
18
19
20 Except for -s, command line options may appear in any order, may be
21 repeated, and may be intermingled with the optional filenames. Command
22 line options are processed in the order specified. This means that
23 option sequences like ``-e15 -l60'' will yield results different from
24 ``-l60 -e15''. Options are applied to all filenames on the command
25 line.
26
28 The following options are supported:
29
30 -s Shears off leading characters on each line up to the
31 first tab and places up to 8 of the sheared characters at
32 the end of the line. If more than 8 characters (not
33 counting the first tab) are sheared, the eighth character
34 is replaced by a * and any characters to the right of it
35 are discarded. The first tab is always discarded.
36
37 An error message and program exit will occur if this
38 option is used on a file without a tab on each line. The
39 characters sheared off are saved internally until all
40 other options specified are applied to that line. The
41 characters are then added at the end of the processed
42 line.
43
44 For example, to convert a file with leading digits, one
45 or more tabs, and text on each line, to a file beginning
46 with the text, all tabs after the first expanded to spa‐
47 ces, padded with spaces out to column 72 (or truncated to
48 column 72), and the leading digits placed starting at
49 column 73, the command would be:
50
51 newform -s -i -l -a -e filename
52
53
54 -itabspec Input tab specification: expands tabs to spaces, accord‐
55 ing to the tab specifications given. Tabspec recognizes
56 all tab specification forms described in tabs(1). In
57 addition, tabspec may be -, in which newform assumes that
58 the tab specification is to be found in the first line
59 read from the standard input (see fspec(4)). If no tab‐
60 spec is given, tabspec defaults to −8. A tabspec of −0
61 expects no tabs; if any are found, they are treated as
62 −1.
63
64
65 -otabspec Output tab specification: replaces spaces by tabs,
66 according to the tab specifications given. The tab speci‐
67 fications are the same as for -itabspec. If no tabspec is
68 given, tabspec defaults to −8. A tabspec of −0 means that
69 no spaces will be converted to tabs on output.
70
71
72 -bn Truncate n characters from the beginning of the line when
73 the line length is greater than the effective line length
74 (see −ln). Default is to truncate the number of charac‐
75 ters necessary to obtain the effective line length. The
76 default value is used when -b with no n is used. This
77 option can be used to delete the sequence numbers from a
78 COBOL program as follows:
79
80 newform -l1 -b7 filename
81
82
83 -en Same as -bn except that characters are truncated from the
84 end of the line.
85
86
87 -pn Prefix n characters (see -cchar) to the beginning of a
88 line when the line length is less than the effective line
89 length. Default is to prefix the number of characters
90 necessary to obtain the effective line length.
91
92
93 -an Same as -pn except characters are appended to the end of
94 a line.
95
96
97 -f Write the tab specification format line on the standard
98 output before any other lines are output. The tab speci‐
99 fication format line which is printed will correspond to
100 the format specified in the last -o option. If no -o
101 option is specified, the line which is printed will con‐
102 tain the default specification of −8.
103
104
105 -cchar Change the prefix/append character to char. Default char‐
106 acter for char is a space.
107
108
109 -ln Set the effective line length to n characters. If n is
110 not entered, -l defaults to 72. The default line length
111 without the -l option is 80 characters. Note: Tabs and
112 backspaces are considered to be one character (use -i to
113 expand tabs to spaces).
114
115 The −l1 must be used to set the effective line length
116 shorter than any existing line in the file so that the -b
117 option is activated.
118
119
121 The following operand is supported:
122
123 filename Input file
124
125
127 The following exit values are returned:
128
129 0 Successful operation.
130
131
132 1 Operation failed.
133
134
136 See attributes(5) for descriptions of the following attributes:
137
138
139
140
141 ┌───────────────────────────────────────────────────────────┐
142 │ATTRIBUTE TYPE ATTRIBUTE VALUE │
143 │Availability SUNWesu │
144 └───────────────────────────────────────────────────────────┘
145
147 csplit(1), tabs(1), fspec(4), attributes(5)
148
150 All diagnostics are fatal.
151
152 usage: ...
153
154 newform was called with a bad option.
155
156
157 "not -s format"
158
159 There was no tab on one line.
160
161
162 "can't open file"
163
164 Self-explanatory.
165
166
167 "internal line too long"
168
169 A line exceeds 512 characters after being expanded in the internal
170 work buffer.
171
172
173 "tabspec in error"
174
175 A tab specification is incorrectly formatted, or specified tab
176 stops are not ascending.
177
178
179 "tabspec indirection illegal"
180
181 A tabspec read from a file (or standard input) may not contain a
182 tabspec referencing another file (or standard input).
183
184
186 newform normally only keeps track of physical characters; however, for
187 the -i and -o options, newform will keep track of backspaces in order
188 to line up tabs in the appropriate logical columns.
189
190
191 newform will not prompt the user if a tabspec is to be read from the
192 standard input (by use of -i- or -o-).
193
194
195 If the -f option is used, and the last -o option specified was -o-, and
196 was preceded by either a -o- or a -i-, the tab specification format
197 line will be incorrect.
198
199
200
201SunOS 5.11 21 Jul 1997 newform(1)