Thursday, November 29, 2007

Convert tabs to a specified number of spaces

It comes handy to know a few unix commands to quickly convert the tabs in a file to a specified number of spaces. This is pretty useful for developers who need to make sure they are following a non-tab coding style in their source codes.

$ expand -<number_of_spaces> | cat -t -v | tee <destinate_file>