[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 2

expand Command

Purpose

Writes to standard output with tabs changed to spaces.

Syntax

expand [ -t TabList ] [ File ... ]

Description

The expand command writes the named files or standard input to standard output, and replaces the tab characters with one or more space characters. Any backspace characters are copied to the output and cause the column position count for tab stop calculations to decrement; the column position count will not decrement below zero.

Note: The File parameter must be a text file.

Flags

-t TabList Specifies the position of the tab stops. The default value of a tab stop is 8 column positions.

The TabList variable must consist of a single positive-decimal integer or multiple positive-decimal integers. The multiple integers must be in ascending order, and must be separated by commas or by blank characters with quotation marks around the integers. The single TabList variable sets the tab stops an equal number of column positions apart. The multiple TabList variable sets the tab stops at column positions that correspond to the integers in the TabList variable.

If the expand command processes a tab stop beyond the last one specified in the TabList variable, the tab stop is replaced by a single-space character in the output.

Exit Status

This command returns the following exit values:

0 Successful completion.
>0 An error occurred.

Examples

  1. To adjust the tab stops an equidistance amount in text.fil, enter:

    expand -t 3 text.fil

    If text.fil contains:

    1       2        3456789

    then the expand command displays:

    1  2        3456789
  2. To adjust the tab stops a varied amount in text.fil, enter:

    expand -t 3,15,22  text.fil

    OR

    expand -t "3 15 22" text.fil

    If text.fil contains:

    1      2       3      456789

    then the expand command displays:

    1  2       3      456789

Files

/usr/bin/expand Contains the expand command.

Related Information

The newform command, tab command, unexpand command, untab command.

Files Overview in the AIX 5L Version 5.2 System User's Guide: Operating System and Devices introduces you to files and the way you can work with them.

Input and Output Redirection Overview in the AIX 5L Version 5.2 System User's Guide: Operating System and Devices describes how the operating system processes input and output.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]