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 < <EOF >b.tab 1 2001 2 3001 3 5001 4 1001 EOF : tmp ; tablify --no-headers b.tab +--------+--------+ | Field1 | Field2 | +--------+--------+ | 1 | 2001 | | 2 | 3001 | | 3 | 5001 | | 4 | 1001 | +--------+--------+ 4 records returned
Related articles
Related Articles:
- 2011/02/06 bash regular expressions
- 2010/04/28 String and Array Creation
- 2010/03/24 Recursive Regular Expressions
- 2010/01/04 Display the output of a command from the first line until the first instance of a regular expression.
- 2011/01/27 fork a new process in perl
Authored By Amit Agarwal
Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.