samy
samy

Reputation: 1440

How can i tell mysql to use the ascii unit separator (31) as line terminator

I want to write a select statement into a file from the mysql terminal client and use the ASCII unit separator control character (31) as line terminator. How can i do this?

I tried:

SELECT something FROM sometable WHERE id<50 INTO OUTFILE '/tmp/test.txt' LINES TERMINATED BY CHAR(31);

but this does not work because the char() function is not valid there.

Any Ideas?

Upvotes: 0

Views: 303

Answers (1)

Olli
Olli

Reputation: 1738

You can use the following query to create a dump with your control character:

SELECT something FROM sometable WHERE id<50 INTO OUTFILE '/tmp/test.txt' LINES TERMINATED BY 0x1f;

this way you can use the hex value for character generation.

Upvotes: 1

Related Questions