How to format CLI tabular data?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I write many CLI scripts in PHP to clean up DB records, etc via crontab
scripts. Often though, I implement command line switches to 'debug' or see
various data as a precaution before actually purging.

Perl has some neat tools built in to format tabular data:
http://www.usenix.org/publications/perl/perl08.html

Does PHP have any tools like this? I'd prefer not to pull in some PEAR
package or other bloat, but I'll take what I can get if it actually works
well. I was hoping there are some tips/tricks to show simple tabular data:

i.e.:

# foo.php --showgroups

==================================
              Groups
==================================
Name:     Expires:     Date:
--------  ------------ -----------
groupA        3 hours   2007-10-08
groupBeta    10 hours   2007-11-10
groupC        1 week    2007-12-31


notice basic things like alignment, 
length of data (as in 'tabs' won't work), etc.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux