expand

expand tabs to spaces 

Command


SYNOPSIS

expand [-t tablist] [file ...]

expand [-number] [-number,number...] [file ...]


DESCRIPTION

expand reads text input from the files specified on the command line, converts tabs into spaces, and writes the result to the standard output. If you do not specify any files on the command line, expand reads from the standard input.

expand preserves backspace characters. By default, tab stops are set every eight columns. A tab after the last tabstop is replaced by a space.

Options

The first syntax of expand accepts the following option:

-t tablist 

sets tab stops at positions indicated by tablist. Numbers in tablist must be in ascending order (origin 0) and separated by commas or blanks; however the list must be one argument so you need shell quoting if you are using blanks. The list may consist of a single number, in which case tabs are set every tablist positions apart.

The second syntax of expand (which the POSIX standard considers obsolete) accepts the following options:

-number 

sets tab stops every number columns.

-number,number... 

sets tab stops at each column number (origin 0).


DIAGNOSTICS

Possible exit status values are:

0 

Successful completion.

1 

Failure due to any of the following:

— cannot open the input file
— insufficient memory
— invalid tab stop specification


PORTABILITY

POSIX.2. x/OPEN Portability Guide 4.0. 4.2 BSD UNIX and up. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022. Windows Server 2025.


NOTE

The expand command provided with PTC MKS Toolkit should not be confused with the cmd.exe expand command.


AVAILABILITY

PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Commands:
pr, unexpand


PTC MKS Toolkit 10.5 Documentation Build 40.