Forrest logo
back to the expand tool

expand:tldr:1b402

expand: Use a comma separated list of explicit tab positions.
$ expand -t=${1,4,6}
try on your machine

The command "expand -t=${1,4,6}" is used to expand tab characters to spaces.

Here is an explanation of each part of the command:

  • "expand" is the command itself, which is used to expand tabs.
  • "-t" is an option that specifies the tab stops.
  • The "${1,4,6}" part is called brace expansion, which defines the tab stops to be used. In this case, it expands to three tab stops: 1, 4, and 6. This means that the first tab is expanded to 1 space, the second tab to 4 spaces, and the third tab to 6 spaces.

For example, if you have a file with the following content:

Hello    World

Running the command "expand -t=${1,4,6} file.txt" will replace the tabs in the file with spaces according to the tab stops defined. The resulting output could look like this:

Hello World

Here, the first tab is replaced with a single space, the second tab is replaced with four spaces, and the third tab is replaced with six spaces.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the expand tool