Previous | Table of Contents | Next |
DESCRIPTION
The external expand command expands tabs to spaces. The expand command reads the named files or the standard input, changes the tabs to the appropriate number of blanks, and writes the results on the standard output.
The external unexpand command replaces leading spaces and tabs with just tabs where possible.
COMMAND FORMAT
Following is the general format of the expand command.
expand [ -tabstop -tab1,tab2,tab3,...,tabn ] [ file_list ] unexpand [ -a ] [ file_list ]
Options
The following options may be used to control how expand functions.
- tabstop | Sets tab stops tabstop spaces apart. |
- tab1,.,tabn | Sets tabs at specific tab positions defined by tab1 through tabn. |
-a | Tabs are inserted at all occurrences that would replace two or more spaces. Without the -a option unexpand only replaces leading blanks and tabs. |
Arguments
The following argument may be passed to the expand command.
file_list | The list of files read and processed by expand . If no files are specified expand reads the standard input. |
RELATED COMMANDS
Refer to the tabs command described in Module 130.
RELATED FILES
The expand command reads from standard input or files and writes to standard output.
APPLICATIONS
You use the expand command to convert tab characters to the appropriate number of spaces. You may find expand useful to preprocess character files that contain tabs before performing character processing on the files. For example, you may want to remove tabs before sorting or examining specific columns of a file.
TYPICAL OPERATION
In this activity you use the expand command to remove tabs from a file containing tab-separated columns. Begin at the shell prompt.
Previous | Table of Contents | Next |