Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ unexpand(1) — Digital UNIX 3.2c

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fold(1)

expand(1)  —  Commands

NAME

expand, unexpand − Replaces tab characters with spaces or spaces with tab characters

SYNOPSIS

Current syntax

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

unexpand [-a] [-t tablist] [file ...]

Obsolescent syntax

expand [-tabstop | -tab1,tab2,...,tabn] [file ...]

The expand command changes tab characters to spaces in the named files, or the standard input, and writes the result to the standard output. 

The unexpand command puts tab characters back into the data from the standard input, or the named files, and writes the result to the standard output. 

FLAGS

-aReplaces spaces at the beginning of each line with a tab, and inserts tab characters wherever their presence compresses the resultant file by replacing two or more characters.  When the -t flag is specified with the unexpand command, the -a flag has no effect.  (unexpand command only)

-t tablistSpecifies the tab stops.  The tablist argument consists of a single positive decimal integer or multiple positive decimal integers, separated by spaces or commas, in ascending order.  If a single number is specified, tabs are set tablist column positions apart instead of the default (8).  If multiple numbers are specified, tabs are set at those specific column positions.  Tabbing to tab stop position n thus causes the next character output to be in the (n+1)th column position on that line. 

If expand has to process a tab character at a position beyond the last of those specified in a multiple tab stop list, the tab character is replaced by a single space in the output. 

-tabstopSets tab stops tabstop spaces apart instead of the default (8).  (Obsolescent)

-tab1, tab2, ..., tabn
Sets tab stops at specified columns.  Columns are measured in bytes. (Obsolescent)

DESCRIPTION

Backspace characters are preserved in the output and decrement the column count for tab calculations. The column position count cannot be decremented below zero. The expand command is useful for preprocessing character files (before sorting, looking at specific columns, and so on.) that contain tab characters. 

By default, unexpand converts only spaces that are within sequences of spaces and tab characters at the beginnings of lines.  Use -a to convert other sequences of spaces. 

EXAMPLES

     1.To replace tab characters in file with spaces, enter:

expand file

     2.To replace the spaces in file with tab characters, enter:

unexpand -a file

RELATED INFORMATION

Commands:  fold(1). 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026