United States-English |
|
|
HP-UX Reference > Aadjust(1)HP-UX 11i Version 3: February 2007 |
|
NAMEadjust — simple text formatter DESCRIPTIONThe adjust command is a simple text formatter for filling, centering, left and right justifying, or only right justifying text paragraphs, and is designed for interactive use. It reads the concatenation of input files (or standard input if none are given) and produces on standard output a formatted version of its input, with each paragraph formatted separately. If - is given as an input filename, adjust reads standard input at that point (use -- as an argument to separate - from options.) adjust reads text from input lines as a series of words separated by space characters, tabs, or newlines. Text lines are grouped into paragraphs separated by blank lines. By default, text is copied directly to the output, subject only to simple filling (see below) with a right margin of 72, and leading spaces are converted to tabs where possible. OptionsThe adjust command recognizes the following command-line options:
Only one of the -c, -j, and -r options is allowed in a single command line. DetailsBefore doing anything else to a line of input text, adjust first handles backspaces, rubbing out preceding characters in the usual way. Next, it ignores all nonprintable characters except tab. It then expands all tabs to spaces. For simple text filling, the first word of the first line of each paragraph is indented the same amount as in the input line. Each word is then carried to the output followed by one space. "Words" ending in terminal_character[quote][closing_character] are followed by two spaces, where terminal_character is any of ., :, ?, or !; quote is a single closing quote (') or double-quote character (" ), and close is any of ), ], or }. Here are some examples: end. of? sentence.' sorts!" of.) words?"] (adjust does not place two spaces after a pair of single closing quotes ('') following a terminal_character). adjust starts a new output line whenever adding a word (other than the first one) to the current line would exceed the right margin. adjust understands indented first lines of paragraphs (such as this one) when filling. The second and subsequent lines of each paragraph are indented the same amount as the second line of the input paragraph if there is a second line, else the same as the first line.
Tag words are passed through without change of column position, even if they extend beyond the right margin. The rest of the line is filled or right justified from the position of the first nontag word. When -j is given, adjust uses an intelligent algorithm to insert spaces in output lines where they are most needed, until the lines extend to the right margin. First, all one space word separators are examined. One space is added to each separator, starting with the one having the most letters between it and the preceding and following separators, until the modified line reaches the right margin. If all one space separators are increased to two spaces and more spaces must be inserted, the algorithm is repeated with two space separators, and so on. Output line indentation is held to one less than the right margin. If a single word is larger than the line size (right margin minus indentation), that word appears on a line by itself, properly indented, and extends beyond the right margin. However, if -r is used, such words are still right justified, if possible. If the current locale defines class names ekinsoku and bkinsoku (see iswctype(3C)), adjust formats the text in accordance with the ekinsoku/bkinsoku character classification and margin settings (see -r, -j, and -m options). EXTERNAL INFLUENCESEnvironment VariablesLANG provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the default value of "C" (see lang(5)) is used. If any of the internationalization variables contains an invalid setting, adjust will behave as if all internationalization variables are set to "C". See environ(5). LC_ALL If set to a nonempty string value, overrides the values of all the other internationalization variables. LC_CTYPE determines the interpretation of text as single and/or multi-byte characters, the classification of characters as printable, and the characters matched by character class expressions in regular expressions. LC_MESSAGES determines the locale that should be used to affect the format and contents of diagnostic messages written to standard error and informative messages written to standard output. NLSPATH determines the location of message catalogs for the processing of LC_MESSAGES. DIAGNOSTICSadjust complains to standard error and later returns a nonzero value if any input file cannot be opened (it skips the file). It does the same (but quits immediately) if the argument to -m or -t is out of range, or if the program is improperly invoked. Input lines longer than BUFSIZ are silently split (before tab expansion) or truncated (afterwards). Lines that are too wide to center begin in column 1 (no leading spaces). EXAMPLESThis command is useful for filtering text while in vi(1). For example, !}adjust reformats the rest of the current paragraph (from the current line down), evening the lines. The vi command: :map ^X {!}adjust -j^V^M (where ^ denotes control characters) sets up a useful "finger macro". Typing ^X (Ctrl-X) reformats the entire current paragraph. adjust -m1 is a simple way to break text into separate words without whitespace, except for tagged-paragraph tags. WARNINGSThis program is designed to be simple and fast. It does not recognize backslash to escape whitespace or other characters. It does not recognize tagged paragraphs where the tag is on a line by itself. It knows that lines end in newline or null, and how to deal with tabs and backspaces, but it does not do anything special with other characters such as form feed (they are simply ignored). For complex operations, standard text processors are likely to be more appropriate. This program could be implemented instead as a set of independent programs, fill, center, and justify (with the -r option). However, this would be much less efficient in actual use, especially given the program's special knowledge of tagged paragraphs and last lines of paragraphs. |
Printable version | ||
|