Re: select ... into local outfile ... ???
Thanks, Tyler, That's very helpful. Dennis --- On Sat, 9/3/11, Tyler Poland tpol...@engineyard.com wrote: From: Tyler Poland tpol...@engineyard.com Subject: Re: select ... into local outfile ... ??? To: mysql@lists.mysql.com Date: Saturday, September 3, 2011, 3:45 AM Dennis, The following closely simulates the default INTO OUTFILE, you'll have to modify it slightly for your purposes: mysql --delimiter=comma -N select_statement.sql \ | sed 's/\/\\\/g' \ | sed 's/\t/\,\/g' \ | sed 's/$/\/g' \ | sed 's/^/\/g' \ | sed 's/\NULL\/\\N/g' \ | sed 's/\\t/\t/g' ' output.txt Tyler * *On 9/2/11 3:40 PM, Dennis wrote: hi, there, the following is my sql statement: SELECT HIGH_PRIORITY SQL_BIG_RESULT SQL_NO_CACHE tb.url_sign, m_url, m_title, m_weight INTO OUTFILE '/tmp/a.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '\' LINES TERMINATED BY '\n' STARTING BY '=' FROM d_local.ta, d_news.tbWHERE ta.url_sign = tb.url_sign Before, the server and the client were on the same machine; now, I need to generate the output file on client (which is on a different machine from the server). But it seams that there is no select ... into LOCAL file statement.Any suggestion is appreciated. Dennis
Re: select ... into local outfile ... ???
2011/09/03 03:40 +0800, Dennis But it seems that there is no select ... into LOCAL file statement. Any suggestion is appreciated. Indeed: you can use only standard output. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
select ... into local outfile ... ???
hi, there, the following is my sql statement: SELECT HIGH_PRIORITY SQL_BIG_RESULT SQL_NO_CACHE tb.url_sign, m_url, m_title, m_weight INTO OUTFILE '/tmp/a.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '\' LINES TERMINATED BY '\n' STARTING BY '=' FROM d_local.ta, d_news.tbWHERE ta.url_sign = tb.url_sign Before, the server and the client were on the same machine; now, I need to generate the output file on client (which is on a different machine from the server). But it seams that there is no select ... into LOCAL file statement.Any suggestion is appreciated. Dennis
Re: select ... into local outfile ... ???
Dennis, The following closely simulates the default INTO OUTFILE, you'll have to modify it slightly for your purposes: mysql --delimiter=comma -N select_statement.sql \ | sed 's/\/\\\/g' \ | sed 's/\t/\,\/g' \ | sed 's/$/\/g' \ | sed 's/^/\/g' \ | sed 's/\NULL\/\\N/g' \ | sed 's/\\t/\t/g' ' output.txt Tyler * *On 9/2/11 3:40 PM, Dennis wrote: hi, there, the following is my sql statement: SELECT HIGH_PRIORITY SQL_BIG_RESULT SQL_NO_CACHE tb.url_sign, m_url,m_title, m_weightINTO OUTFILE '/tmp/a.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '\' LINES TERMINATED BY '\n' STARTING BY '=' FROM d_local.ta, d_news.tbWHERE ta.url_sign = tb.url_sign Before, the server and the client were on the same machine; now, I need to generate the output file on client (which is on a different machine from the server). But it seams that there is no select ... into LOCAL file statement.Any suggestion is appreciated. Dennis
Re: INTO LOCAL OUTFILE?
At 9:14 -0900 3/16/03, Tim Johnson wrote: Hello All: I am using Ver 11.15 Distrib 3.23.41, for redhat-linux-gnu (i386) I believe that INTO LOCAL OUTFILE is not implemented, but all the same, I would like to save a selection set into a local output (text) file. Can someone suggest a way to use mysqldump to do the same (or any other strategy). I've tried using the --tab option but get am getting Errcode: 13 There is no analog to INTO LOCAL OUTFILE. You can save the output of a query executed in mysql to a file, which will give you a tab-delimited file. In some cases, that may be sufficient. mysql -e select * from tbl_name db_name output TIA -- Tim Johnson [EMAIL PROTECTED] http://www.alaska-internet-solutions.com http://www.johnsons-web.com -- Paul DuBois http://www.kitebird.com/ sql, query - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: INTO LOCAL OUTFILE?
Hi Paul: * Paul DuBois [EMAIL PROTECTED] [030316 09:59]: At 9:14 -0900 3/16/03, Tim Johnson wrote: Hello All: I am using Ver 11.15 Distrib 3.23.41, for redhat-linux-gnu (i386) I believe that INTO LOCAL OUTFILE is not implemented, but all the same, I would like to save a selection set into a local output (text) file. Can someone suggest a way to use mysqldump to do the same (or any other strategy). I've tried using the --tab option but get am getting Errcode: 13 There is no analog to INTO LOCAL OUTFILE. You can save the output of a query executed in mysql to a file, which will give you a tab-delimited file. In some cases, that may be sufficient. mysql -e select * from tbl_name db_name output Paul, that works just fine. I note that column names are inserted as the first line. Is there a way to eliminate that? If not, that is just fine. Thank you very much -tim- -- Tim Johnson [EMAIL PROTECTED] http://www.alaska-internet-solutions.com http://www.johnsons-web.com - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: INTO LOCAL OUTFILE?
At 10:34 -0900 3/16/03, Tim Johnson wrote: Hi Paul: * Paul DuBois [EMAIL PROTECTED] [030316 09:59]: At 9:14 -0900 3/16/03, Tim Johnson wrote: Hello All: I am using Ver 11.15 Distrib 3.23.41, for redhat-linux-gnu (i386) I believe that INTO LOCAL OUTFILE is not implemented, but all the same, I would like to save a selection set into a local output (text) file. Can someone suggest a way to use mysqldump to do the same (or any other strategy). I've tried using the --tab option but get am getting Errcode: 13 There is no analog to INTO LOCAL OUTFILE. You can save the output of a query executed in mysql to a file, which will give you a tab-delimited file. In some cases, that may be sufficient. mysql -e select * from tbl_name db_name output Paul, that works just fine. I note that column names are inserted as the first line. Is there a way to eliminate that? If not, that is just fine. Yes, use either the --skip-column-names or -N option. Alternatively, use -ss (double silent), but's mainly for versions older then 3.22.20 that don't support --skip-column-names/-N. Thank you very much -tim- -- Tim Johnson [EMAIL PROTECTED] http://www.alaska-internet-solutions.com http://www.johnsons-web.com -- Paul DuBois http://www.kitebird.com/ sql, query - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: INTO LOCAL OUTFILE?
On 16-Mar-2003 Tim Johnson wrote: Hi Paul: * Paul DuBois [EMAIL PROTECTED] [030316 09:59]: At 9:14 -0900 3/16/03, Tim Johnson wrote: Hello All: I am using Ver 11.15 Distrib 3.23.41, for redhat-linux-gnu (i386) I believe that INTO LOCAL OUTFILE is not implemented, but all the same, I would like to save a selection set into a local output (text) file. Can someone suggest a way to use mysqldump to do the same (or any other strategy). I've tried using the --tab option but get am getting Errcode: 13 There is no analog to INTO LOCAL OUTFILE. You can save the output of a query executed in mysql to a file, which will give you a tab-delimited file. In some cases, that may be sufficient. mysql -e select * from tbl_name db_name output Paul, that works just fine. I note that column names are inserted as the first line. Is there a way to eliminate that? If not, that is just fine. mysql -N -e select * from tbl_name db_name output Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. (53kr33t w0rdz: sql table query) - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
is there local outfile?
is there a way or possibly a command line tool for querying a remote file and having it dump the select into a local outfile. it does exacly what i want from the server, but only to create a file on the server. and just adding local doesn't/hasn't work. and mysqldump outputs sql, which isn't what i'm looking for either. SELECT blah, blah2, blah3 . INTO LOCAL OUTFILE 'blubering.txt' FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '' FROM chatter_table; -- If there are self-made purgatories, then we all have to live in them. -- Spock, This Side of Paradise, stardate 3417.7 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php