Forrest logo
back to the unexpand tool

unexpand:tldr:25a96

unexpand: Convert only leading sequences of blanks (overrides -a).
$ unexpand --first-only ${filename}
try on your machine

The command "unexpand --first-only ${filename}" is used to convert leading spaces to tab characters in a file, but only for the first sequence of consecutive spaces on each line.

Here's a breakdown of the command:

  • "unexpand": This is the command that converts spaces to tabs.
  • "--first-only": This option tells the "unexpand" command to only convert leading spaces for the first sequence of consecutive spaces on each line. In other words, if there are multiple sequences of consecutive spaces on a line, only the first sequence will be converted to tabs.
  • "${filename}": This is the placeholder for the actual name of the file on which you want to perform the conversion. You need to replace "${filename}" with the actual name or path to the file when running the command.

Overall, the command allows you to replace leading spaces with tabs, but it does so only for the first sequence of consecutive spaces on each line in the given file.

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 unexpand tool