MySQL Forums
Forum List  »  General

Re: Outputting a tab character to file redirection
Posted by: Rich Davis
Date: January 06, 2015 03:41PM

As a workaround, I have found that piping the output to sed and then redirecting that output to the output file will give the desired result:

[user@devbox:~]$ mysql -u user -p'password' --skip-column-names -e "SELECT CONCAT('surame', '\t', 'givenname') AS name" > /tmp/output && cat /tmp/output
surame\tgivenname

[user@devbox:~]$ mysql -u user -p'password' --skip-column-names -e "SELECT CONCAT('surame', '\t', 'givenname') AS name" | sed -e "s/\\\t/\t/g" > /tmp/output && cat /tmp/output
surame	givenname

I would like a more elegant solution that does not involve sed if one exists. In the meantime, I will see what else I am able to come up with.

Regards,
Rich

Options: ReplyQuote


Subject
Written By
Posted
Re: Outputting a tab character to file redirection
January 06, 2015 03:41PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.