create text tables from delimited files.

To create simple text tables to paste in emails or to use in any other document where you want to show a table, here is something that you can use. There is a perl module which provides “tablify“. And here is how to use it:

sudo yum install perl-Text-RecordParser

This will install a command “tablify” that you can use in number of ways. Here is a simple example to use it. You can read the man pages to see how you can use it.

: tmp ; cat < 
1	2001
2	3001
3	5001
4	1001

: tmp ; tablify --no-headers 
| Field1 | Field2 |
| 1      | 2001   |
| 2      | 3001   |
| 3      | 5001   |
| 4      | 1001   |
4 records returned

Enhanced by Zemanta

convert tabs to spaces, the easy way

Lots of times you want to convert tabs to spaces and sometimes from a shell script, if that is the case, then simple solution is “tidy“. First you need to install tidy as follows:

sudo yum install tidy

and then you can use the command tab2space.


This will print the output to STDOUT by default which you can redirect if you want.


Enhanced by Zemanta