Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is it possible to modify the string used to delimit output columns in command line MySQL query results? E.g. could I change | to ! or ||?

share|improve this question
add comment

2 Answers

Yes. From mysql documentation:

[mysql commandline] When used interactively, query results are presented in an ASCII-table format. When used noninteractively (for example, as a filter), the result is presented in tab-separated format. The output format can be changed using command options.

Thus, you can pipe mysql commandlines output to sed and change tabs to whatever you want.

see sed doc: http://www.grymoire.com/Unix/Sed.html#uh-6

also there seems to be a patch to add that option explicitly: http://bugs.mysql.com/bug.php?id=8904

share|improve this answer
    
Those are both good suggestions, but sadly they don't fit my needs. the first one because I want to work in interactive mode. And the second because I can not currently put the time into this. I was more looking for a built in solution but it seems that currently there is non. so I will continue reading my Hebrew from left to right :) –  epeleg Mar 10 '11 at 6:54
add comment

According to the manual (on linux man mysql) starting mysql with -s -r options will change your queries from

% mysql
mysql> SELECT CHAR(92);
+----------+
| CHAR(92) |
+----------+
| \        |
+----------+

to

% mysql -s -r
mysql> SELECT CHAR(92);
CHAR(92)
\
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.