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

Re: How to format the command output like MySQL output



陶治江 wrote:
于 2013-10-20 0:53, Lars Noodén 写道:
On 19.10.2013 19:35, 陶治江 wrote:
[snip]
I think it seems good like this, but I do not know how to make out
it.(someone says awk, sed may help, but the environment does not
permit it). Is there some libs or tools can help make output result
good and elegent?
[snip]

Perl would be the next step up, but if awk is not allowed then perl
certainly won't be.

Regards,
/Lars



yes, the whole system size a extremely limited, so the only possible way
is to find a suitable C lib to handle this.


Maybe a silly thought, but: Since your model is MySQL output, maybe take a look at the MySQL source code and see how it's done there. There's actually a tour of the source code here: http://dev.mysql.com/doc/internals/en/guided-tour.html - which might help you find where that printing is done.

Just took a really quick look at the mysql client code (at http://bazaar.launchpad.net/~mysql/mysql-server/5.6/files/head:/client/) - and all I saw were printf statements. Doesn't look like any fancy libraries or tools are being used.

Miles Fidelman

--
In theory, there is no difference between theory and practice.
In practice, there is.   .... Yogi Berra


Reply to: