[go: nahoru, domu]

Jump to content

Unexpand: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
m Syntax
m lang="console"
 
(23 intermediate revisions by 18 users not shown)
Line 1: Line 1:
{{lowercase}}
'''unexpand''' is a command in the [[Unix|UNIX Operating System]]. It is used to convert groups of space [[character (computing)|character]]s into [[tab]]s.
{{Infobox software
| name = unexpand
| logo =
| screenshot =
| screenshot size =
| caption =
| author =
| developer =
| released =
| latest release version =
| latest release date =
| operating system = [[Unix]] and [[Unix-like]]
| platform = [[Cross-platform]]
| genre = [[Command (computing)|Command]]
| license =
| website =
}}
'''unexpand''' is a command in [[Unix]] and [[Unix-like]] [[operating system]]s. It is used to convert groups of space [[character (computing)|character]]s into [[tab character]]s.<ref>{{Cite web |title=unexpand - Compress spaces into tabs |url=https://www.ibm.com/docs/en/zos/2.4.0?topic=descriptions-unexpand-compress-spaces-into-tabs |access-date=2024-05-09 |website=www.ibm.com |language=en-us}}</ref>


For example:
For example:


<syntaxhighlight lang="console">
$ echo " asdf sdf" | unexpand | od -c
0000000 \t \t a s d f s d f \n
$ echo " asdf sdf" | unexpand | od -c
0000000 \t \t a s d f s d f \n
0000014
0000014
$ echo " asdf sdf" | od -c
$ echo " asdf sdf" | od -c
0000000
0000000
0000020 a s d f s d f \n
0000020 a s d f s d f \n
0000032
0000032
</syntaxhighlight>


Here the [[echo]] command prints a string of text that includes multiple consecutive spaces, then the output is directed into the '''unexpand''' command. The resulting output is then displayed by the [[octal]] dump command [[od]]. At the second prompt, the same echo output is sent directly through the '''od''' command. As can be seen by comparing the two, the '''unexpand''' program converts sequences of eight spaces into single tabs (printed as '\t').
Here the [[Echo (command)|echo command]] prints a string of text that includes multiple consecutive spaces, then the output is directed into the '''unexpand''' command. The resulting output is then displayed by the [[octal]] dump command [[Od (Unix)|od]]. At the second prompt, the same echo output is sent directly through the '''od''' command. As can be seen by comparing the two, the '''unexpand''' program converts sequences of eight spaces into single tabs (printed as '\t').


==See also==
[[Category:Unix programs]]
*[[List of Unix commands]]
*[[Expand (Unix)]]

==References==
{{Reflist}}

==External links==
*[https://web.archive.org/web/20051031053512/http://www.linuxmanpages.com/man1/unexpand.1.php] The program's [[manpage]]

{{Unix commands}}
{{Core Utilities commands}}

[[Category:Unix SUS2008 utilities]]

Latest revision as of 01:44, 29 May 2024

unexpand
Operating systemUnix and Unix-like
PlatformCross-platform
TypeCommand

unexpand is a command in Unix and Unix-like operating systems. It is used to convert groups of space characters into tab characters.[1]

For example:

$ echo "                 asdf sdf" | unexpand | od -c
0000000  \t  \t       a   s   d   f       s   d   f  \n
0000014
$ echo "                 asdf sdf" | od -c
0000000
0000020       a   s   d   f       s   d   f  \n
0000032

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

See also[edit]

References[edit]

  1. ^ "unexpand - Compress spaces into tabs". www.ibm.com. Retrieved 2024-05-09.

External links[edit]