NEWFORM(1,C) AIX Commands Reference NEWFORM(1,C)
-------------------------------------------------------------------------------
newform
PURPOSE
Changes the format of a text file.
SYNTAX
+------------------------------------------+
newform ---| one of |--->
^ | +------+ +-----------+ +-----------+ |
| +-| |---| -a -anum |---| |-+
| +- -s -+ | -p -pnum | +- -c char -+
| +-----------+
+-----(A)
+---------------+ +------------------------+
>---| one of |---| one of |--->
| +-----------+ | | +----+ +--- -8 ----+ |
+-| -b -bnum |-+ +-| -i |---|1 |-+
| -e -enum | ^| -o | +- tabspec -+|
+-----------+ |+----+ |
+----------------------+
+----- -180 ------+ +------+ +------------+
>---| +- 72 --+ |---| |---| |---|
+- -l --|1 |-+ +- -f -+ +--- file ---+ |
+- num -+ ^ | |
+--------+ |
|
(A)<---------------+
-----------------
1 Do not put a blank between these items.
Note: This command does not have MBCS support.
DESCRIPTION
The newform command takes lines from file (standard input by default) and
writes the formatted lines to standard output. Lines are reformatted in
accordance with command line flags in effect.
Except for -s, command line flags can appear in any order, can be repeated, and
can be mixed with the file parameter. Command line flags are processed in the
order specified. In other words, flag sequences like "-e15 -l60" yield results
Processed November 8, 1990 NEWFORM(1,C) 1
NEWFORM(1,C) AIX Commands Reference NEWFORM(1,C)
different from "-l60 -e15". Flags are applied to all files on the command
line.
An exit value of 0 indicates normal execution; a 1 indicates an error.
Notes:
1. The newform command normally keeps track of only physical characters;
however, for the -i and -o flags, newform keeps track of backspaces in
order to line up tabs in the appropriate logical columns.
2. The newform command does not prompt you if a tabspec is to be read from
the standard input (by use of -i-- or -o --).
3. If the -f flag is used and the last -o flag specified was -o-- and was
preceded by either a -o-- or a -i--, the tab specification format line will
be incorrect.
FLAGS
-a[num] Adds num characters to the end of the line when the line length is
less than the effective line length (see the -c and -p flags in
this section). The default line length is 80 characters. If you
have selected a language (through the LANG environment variable)
that supports multibyte characters, the 80-character limit may be
reduced by as much as 50%, depending on the character code set
being used.
-b[num] Truncates num characters from the beginning of the line when the
line length is greater than the effective line length (see -lnum).
The default action truncates the number of characters necessary to
obtain the effective line length. If you specify -b with no num,
the default takes effect. This flag can be used to delete the
sequence numbers from a COBOL program as follows:
newform -l1 -b7 file-name
The -l1 must be used to set the effective line length shorter than
any existing line in the file so that the -b flag is activated.
-c[char] Changes the prefix/add character to char. Default character for
char is a space.
-e[num] Same as -bnum except that characters are truncated from the end of
the line.
-f Writes the tab specification format line to standard output before
any other lines are written. The tab specification format line
displayed corresponds to the format specified in the last -o flag.
If no -o flag is specified, the line displayed contains the
default specification of -8.
Processed November 8, 1990 NEWFORM(1,C) 2
NEWFORM(1,C) AIX Commands Reference NEWFORM(1,C)
-i[tabspec] Replaces all tabs in the input with the number of spaces specified
by tabspec. tabspec recognizes all tab specification forms
described in "tabs." If you specify a -- (minus minus) for the
value of tabspec, newform assumes that the tab specification can
be found in the first line read from standard input (see fspec in
AIX Operating System Technical Reference). The default tabspec is
-8. A tabspec of -0 expects no tabs; if any are found, they are
treated as -1.
-l[num] Sets the effective line length to num characters. If num is not
entered, -l defaults to 72. The default line length without the
-l flag is 80 characters. Tabs and backspaces are considered to
be one character (use -i to expand tabs to spaces).
-o[tabspec] Replaces spaces in the input with a tab in the output, according
to the tab specifications given. The default tabspec is -8. A
tabspec of -0 means that no spaces are converted to tabs on
output.
-p[num] Prefixes num characters (see -cchar) to the beginning of a line
when the line length is less than the effective line length. The
default action is to prefix the number of characters that are
necessary to obtain the effective line length.
-s Removes leading characters on each line up to the first tab and
places up to eight of the removed characters at the end of the
line. If more than eight characters (not counting the first tab)
are removed, the eighth character is replaced by an "*" (asterisk)
and any characters to the right of it are discarded. The first
tab is always discarded.
The removed characters are saved internally until all other flags
specified are applied to that line. The characters are then added
at the end of the processed line.
For example, to convert a file with leading digits, one or more
tabs, and text on each line, to a file beginning with the text,
all tabs after the first expanded to spaces, padded with spaces
out to column 72 (or truncated to column 72), and the leading
digits placed starting at column 73, the command would be as
follows:
newform -s -i -l -a -e file-name
The newform command displays an error message and stops if this
flag is used on a file without a tab on each line.
RELATED INFORMATION
See the following commands: "tabs" and "csplit."
See the fspec file in AIX Operating System Technical Reference.
Processed November 8, 1990 NEWFORM(1,C) 3