tab2space

Expand tabs and ensure consistent line endings.

Syntax
      tab2space [options] [infile [outfile]] ...


Options

   -dos or -crlf  Set line ends to CRLF (Windows - default)

   -mac or -cr    Set line ends to CR (classic Mac OS)

   -unix or -lf   Set line ends to LF (Unix / Mac OS X)

   -tabs          Preserve tabs, e.g. for Makefile.

   -tn            Set tabs to n (default is 4) spaces.

   -help or -h    Display this help message.

The iconv program converts the encoding of characters in inputfile from one coded character set to another. The result is written to standard output unless otherwise specified by the --output option.

Examples

Convert input.txt to have cr/lf line endings and save as output.txt

$ tab2space input.txt output.txt

Convert input.txt to have unix LF line endings and save as output.txt

$ tab2space -lf input.txt output.txt

“Plus ça change, plus c'est la même chose (The more things change, the more they are the same.)” ~ Jean-Baptiste Alphonse Karr 1849.

Related macOS commands:

chmod - Change access permissions.
GetFileInfo - Get attributes of HFS+ files.
Equivalent PowerShell command: set-eol.ps1


 
Copyright © 1999-2020 SS64.com
Some rights reserved