Forrest logo
tool overview
On this page you find all important commands for the CLI tool expand. If the command you are looking for is missing please ask our AI.

expand

The expand command line tool is used to convert tabs into spaces or vice versa in a text file. It is commonly used for formatting purposes, such as aligning columns or making code more readable.

Here is a brief explanation of how the expand tool works:

  • By default, expand converts tabs in the input file to spaces. It assumes the tab stops are set at regular intervals of eight spaces.
  • The tool accepts input from a file or standard input. If no file is specified, it reads from the standard input.
  • The modified text is output to the standard output or redirected to a file if specified.
  • The number of spaces used to replace a tab can be adjusted using the -t or --tabs option, followed by the desired number of spaces.
  • The -t option can also accept a comma-separated list of tab-stop locations to use. For example, -t 4,8 sets tabs at positions 4 and 8, with subsequent tabs repeating the pattern.

Here's an example that demonstrates the usage of expand:

$ cat input.txt
Hello   world!  This    is  a   test.

$ expand input.txt
Hello   world!  This    is      a       test.

$ expand -t 4 input.txt
Hello   world!  This    is  a   test.

$ expand -t 4,8 input.txt
Hello   world!   This  is   a  test.

In the first command, the default behavior of expand converts the tabs to spaces. In the second command, the -t 4 option sets the tab stop to every 4 spaces. The third command sets the tab stops to 4 and 8 spaces, and the output reflects this tab pattern.

Overall, the expand command line tool is useful for converting tabs to spaces and controlling the tab stop positions, allowing for consistent and readable formatting in text files.

List of commands for expand:

  • expand:tldr:1b402 expand: Use a comma separated list of explicit tab positions.
    $ expand -t=${1,4,6}
    try on your machine
    explain this command
  • expand:tldr:31407 expand: Convert tabs to spaces, reading from standard input.
    $ expand
    try on your machine
    explain this command
  • expand:tldr:3d74e expand: Have tabs a certain number of characters apart, not 8.
    $ expand -t=${number} ${filename}
    try on your machine
    explain this command
  • expand:tldr:63532 expand: Ignore the directory structure when uncompressing, and add them to a single directory.
    $ expand ${path\to\file-cab} ${path\to\directory} -i
    try on your machine
    explain this command
  • expand:tldr:73857 expand: Uncompress a specific file from a Cabinet file.
    $ expand ${path\to\file-cab} ${path\to\directory} -f:${path\to\file}
    try on your machine
    explain this command
  • expand:tldr:77354 expand: Uncompress a single-file Cabinet file to the specified directory.
    $ expand ${path\to\file-cab} ${path\to\directory}
    try on your machine
    explain this command
  • expand:tldr:a9af6 expand: Convert tabs in each file to spaces, writing to standard output.
    $ expand ${filename}
    try on your machine
    explain this command
  • expand:tldr:be922 expand: Do not convert tabs after non blanks.
    $ expand -i ${filename}
    try on your machine
    explain this command
  • expand:tldr:cbaad expand: Display the list of files in a source Cabinet file.
    $ expand ${path\to\file-cab} ${path\to\directory} -d
    try on your machine
    explain this command
  • expand:tldr:cf62d expand: Uncompress all files from the Cabinet file.
    $ expand ${path\to\file-cab} ${path\to\directory} -f:*
    try on your machine
    explain this command
tool overview