top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to format the command output like MySQL output

+1 vote
474 views

I am now focusing on the development of a script interpreter (some thing like shell) in embedded environment, and its functions mainly output the data in specified address. In order to make it seems better, I want to format the output result like MySQL output listed below for example

||+--------+-------------+
| address| value |
+--------+-------------+|
| 0x1110| 0x01 |
+--------+-------------+
| 0x1111 | 0x00 |
+--------+-------------+|

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?

posted Oct 20, 2013 by Mandeep Sehgal

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Do you have access to perl in your environment? Perl has excellent print formatting abilities.

answer Oct 20, 2013 by Dewang Chaudhary
no, embeded environment, a lot of things are extremely striped. I am wondering whether should I write it on my own side.
What tools do you have available in your environment? You have no awk or sed. How about a text editor? Do you have vi or vim? Both of those are based on the ed editor. You might have the ed editor.
No editor avaiable.
Tell you the truth, my program runs on the Router, so a lot of things are not available by default. I think if there is no C lib which can provide this, the only possible way is to write it by myself.
So you have no C lib on the router. What tools do you have available to write a tool with? Can you write and cross compile something for this environment on another computer and then load it onto the router?
Similar Questions
+3 votes

Probably is simple and silly question, I should have googled but still want to ask.
I want to run a script at the login to the Linux system, what is the best way to achieve this.

+2 votes

I am trying installing Mysql server using RPM bundle

rpm -i MySQL-server-5.6.16-1.el6.x86_64.rpm
rpm -i MySQL-client-5.6.16-1.el6.x86_64.rpm

The server RPM places data under the /var/lib/mysql directory. The RPM also creates a login account for a user named mysql (if one does not exist) to use for running the MySQL server, and creates the appropriate entries in /etc/init.d/ to start the server automatically at boot time. (This means that if you have performed a previous installation and have made changes to its startup script, you may want to make a copy of the script so that you do not lose it when you install a newer RPM.

When I checked /var/lib I found none for mysql, any thoughts?

...