tabs Command

Purpose

Sets tab stops on terminals.

Syntax

tabs [ TabSpec ... ] [ +m [ Number ] ] [ -TTerminal ... ]

Description

The tabs command specifies tab stops on terminals that support remotely settable hardware tab characters. Tab stops are set according to the TabSpec parameter, and previous settings are erased.

When you use the tabs command, always refer to the leftmost column number as 1, even if your workstation refers to it as 0.

If you do not specify the TabSpec parameter, the default value is -8.

The following preset formats can be specified for the TabSpec parameter:

Item Description
-a Sets the tabs to 1, 10, 16, 36, and 72 (IBM® System/370 Assembler first format).
-a2 Sets the tabs to 1, 10, 16, 40, and 72 (IBM System/370 Assembler second format).
-c Sets the tabs to 1, 8, 12, 16, 20, and 55 (COBOL normal format).
-c2 Sets the tabs to 1, 6, 10, 14, and 49 (COBOL compact format, columns 1-6 omitted). With this code, the first column position corresponds to card column 7. One space gets you to column 8, and a tab gets you to column 12. Files using this code should include a format specification of:
<:t-c2 m6 s66 d:>
-c3 Sets the tabs to 1, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50, 54, 58, 62, and 67 (COBOL compact format with more tabs than -c2). These tabs provide the recommended format for COBOL. Files using this code should include a format specification of:
<:t-c3 m6 s66 d:>
-f Sets the tabs to 1, 7, 11, 15, 19, and 23 (FORTRAN).
-p Sets the tabs to 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, and 61 (PL/I).
-s Sets the tabs to 1, 10, and 55 (SNOBOL).
-u Sets the tabs to 1, 12, 20, and 44.

In addition to the preset formats, the TabSpecs parameter can include:

Item Description
-Number Sets regularly repeating tabs at every Number column. (The standard operating system tab setting is -8. The -8 setting is required when using the nroff command with the -h flag.) Another special case is the -0 setting, which implies no tabs at all. If more than 20 tabs are set, you must run the tabs command twice to clear them.
 Number1, Number2,... Sets tabs at the specified column numbers (a comma-separated list in ascending order). You can specify up to 40 numbers. If any number except the first has a plus-sign prefix, the prefixed number is added to the previous number for the next setting. Thus, the tab list specified by 1,10,20,30 provides the same tab settings as the tab list specified by 1,10,+10,+10.
-Filep Reads the first line of the Filep file for a format specification. If the tabs command finds a format specification, the tabs command sets tabs as specified. If the tabs command does not find a format specification, it sets tabs to the system default (-8).

It is sometimes convenient to maintain text files with nonstandard tab stop settings (tab stops that are not set at every eighth column). Such files must be converted to a standard format. This is often done by replacing all tab characters with the appropriate number of space characters, before they can be processed by any commands. A format specification occurring in the first line of a text file specifies how tab characters are to be expanded in the remainder of the file.

A format specification consists of a sequence of parameters separated by blanks and surrounded by <: and :>. Each parameter consists of a letter key, possibly followed immediately by a value. The following parameters are recognized:

Item Description
ttabs Specifies the tab stop settings for a file. The value of tabs must be one of the following:
  • A list of column numbers separated by commas, indicating tab stops set at the specified columns.
  • A - (dash) followed immediately by an integer n, indicating tab stops set at intervals of n columns, that is, at 1+n, 1+2*n, and so on.
  • A - (dash) followed by the name of a preset tab stop specification.

    Up to 40 numbers are allowed in a comma-separated list of tab stop settings. If any number (except the first one) is preceded by a plus sign, it is taken as an increment to be added to the previous value. Therefore, the formats t1, 10, 20, 30 and t1, 10, +10, +10 are considered identical.

    Standard tab stops are specified by t-8, or, equivalently, t1, 9, 17, 25. This is the tab stop setting that most system utilities assume, and is the most likely setting to find at a terminal. The specification t-0 specifies no tab stops at all.

    The preset tab stop specifications that are recognized are as follow:

    a
    1, 10, 16, 36, 72

    Assembler, IBM System/370, first format

    a2
    1, 10, 16, 40, 72

    Assembler, IBM System/370, second format

    c
    1, 8, 12, 16, 20, 55

    COBOL, normal format

    c2
    1, 6, 10, 14, 49

    COBOL compact format (columns 1-6 omitted). Using this code, the first typed character corresponds to card column 7; one space gets you to column 8; and a tab gets you to column 12. Files using this tab stop setup should include a format specification as follows:

    <:t-c2 m6 s66 d:>
    c3
    1, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50, 54, 58, 62, 67

    COBOL compact format (columns 1-6 omitted) with more tab stops than c2. This is the recommended format for COBOL. The appropriate format specification is:

    <:t-c3 m6 s66 d:>
    f
    1, 7, 11, 15, 19, 23

    FORTRAN

    p
    1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61

    PL/I

    s
    1, 10, 55

    SNOBOL

    u
    1, 12, 20, 44

    UNIVAC 1100 Assembler

ssize Specifies a maximum line size. The value of size must be an integer. Size checking is performed after tab characters have been expanded, but before the margin is adjusted.
mmargin Specifies the number of space characters to be added to the beginning of each line. The value of margin must be an integer.
d Indicates that the line containing the format specification is to be deleted from the converted file. The d parameter takes no value.
e Indicates that the current format is valid only until another format specification is encountered in the file. The e parameter takes no value.

Default values, which are assumed for parameters not supplied, are t-8 and m0. If the s parameter is not specified, no size checking is performed. If the first line of a file does not contain a format specification, the above defaults are assumed for the entire file. The following is an example of a line containing a format specification:

<:t5,10,15 s72:>

If a format specification can be disguised as a comment, it is not necessary to code the d parameter.

Flags

Item Description
-TTerminal Identifies the terminal so the tabs command can set tabs and margins correctly. The Terminal variable is one of the terminals specified in the greek command. Supported values for the Terminal variable include:
ANSI
Any ANSI terminal, such as a VT100 terminal.
hp
Hewlett-Packard hardcopy terminals.
2621
Hewlett-Packard 2621.
2640
Hewlett-Packard 2640.
2645
Hewlett-Packard 2645.

Additional hardcopy terminals supported by the tabs command include:

  • 1620
  • 1620-12
  • 1620-12-8
  • 1700
  • 1700-12
  • 1700-12-8
  • 300
  • 300-12
  • 300s
  • 300s-12
  • 40-2
  • 4000a
  • 4000a-12
  • 43
  • 450
  • 450-12
  • 450-12-8
  • tn1200
  • tn300
  • oki

If you do not provide the -T flag, the value of the environment variable TERM is used. If the -T flag is provided with no value or if -T and TERM have invalid values, the error message unknown terminal is displayed and the command terminates.

+m Number Moves all tabs to the right the number of columns specified by the Number variable. This flag also sets the left margin to the column specified by the Number variable. If m is specified without a value, the default value for the Number variable is 10. The leftmost margin on most workstations is defined by +m0. The first column for tabs is defined as column 0 not column 1.
Note: If the same flag occurs more than once, only the last flag takes effect.

Exit Status

This command returns the following exit values:

Item Description
0 Successful completion.
>0 An error occurred.

Examples

  1. To set tabs every four spaces, enter:
    tabs -4
  2. To set tabs every ten spaces on a VT100 terminal, enter:
    tabs -10 -TANSI

File

Item Description
/usr/bin/tabs Contains the tabs command.