The Linux expand and unexpand commands sound like they can make files larger and smaller, but what they actually do is turn tabs into spaces and spaces into tabs.
In this post, we’ll use some simple text files to demonstrate what happens when you use expand and unexpand. We’ll also compare how these commands work with some likely more familiar commands—sed and awk—that can provide similar results and offer additional options.
To begin, let’s take a look at this very simple text file:
Source:: Network World – Linux