Arrange output into columns

This is a handy hint if you have to read-through system configuration files.

Virtually all configuration files have some attempt at layout within them, to make for easier reading, usually in the form of spaces between the various configuration options. The problem is that these become eroded by constant editing of the file. When used at the prompt, the column command is able to spot these attempts at layout and use them to arrange the data into columns. It's best demonstrated by a before-and-after example so open a terminal window and type the following: $ cat /etc/fstab used in this way the cat command simply displays the contents of a file. You'll see that /etc/fstab is a pretty messy file.

Now run it through the column command by piping the output of the previous command, as follows: $ cat /etc/fstab|co1umn -t

The -t command-option tells column to figure-out the layout using the spaces within the file.

What you'll see is a file that's better formatted. It should be easier to make out the data within the file. It probably won't be perfect, because column isn't very intelligent. But it'll probably be an improvement.

View images without a graphical environment M 306

Was this article helpful?

0 0

Post a comment