The unexpand command allows you to easily convert spaces to tabs in a file. If you are on the “tabs” side of the tabs vs spaces war, then this utility is for you. It is Richard Hendricks approved.
Source: LXer – Unexpand – Convert Spaces to Tabs on the Linux Command Line