Jump to content

Expand (Unix)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 129.42.208.173 (talk) at 07:45, 9 February 2009 (s/od/od_(unix)/ to prevent unecessary drops to od disambiguation). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

expand is a command in the UNIX Operating System. It is used to convert groups of tabs into space characters.

For example:

$ echo -e "\t foo" | expand | od -c
0000000                                       f   o   o  \n
0000015
$ echo -e "\t foo" | od -c
0000000  \t       f   o   o  \n
0000006


Here the echo command prints a string of text that includes a tab character, then the output is directed into the expand command. The resulting output is then displayed by the octal dump command od_(unix). At the second prompt, the same echo output is sent directly through the od command. As can be seen by comparing the two, the expand program converts the tab (printed as '\t') into spaces.

See also