newform
PURPOSE
Changes the format of a text file.
SYNOPSIS
newform [-s] [-itabspec] [-otabspec] [-bn] [-en] [-pn] [-an] [-f]
[-cchar] [-ln] [files]
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 different from "-l60 -e15". Flags
are applied to all files on the command line.
An exit value of 0 indicates normal execution, a 1 indi-
cates an error.
Notes:
1. The newform command normally only keeps track of
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 effec-
tive line length (see the -c and -p flags in
this section).
-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 acti-
vated.
-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 speci-
fied in the last -o flag. If no -o flag is
specified, the line displayed contains the
default specification of -8.
-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 char-
acters. If num is not entered, -l defaults
to 72. The default line length without the
-l flag is 80 characters. Note that 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 specifica-
tions given. The default tabspec is -8. A
tabspec of -0 means that no spaces are con-
verted 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
The following commands: "tabs" and "csplit."
The fspec file in AIX Operating System Technical Refer-
ence.