Dumping table contents to stdout in tab-separated value format

Dumping table contents to stdout in tab-separated value format

am 21.02.2010 04:03:40 von Yang Zhang

Hi, I'm interested in piping out the contents of a mysql table to
stdout in tab-separated value format, but:

- using 'select * into outfile' can't write to stdout.
- mysqldump --fields-... requires --tab, which requires an output file path.
- I also tried mkfifo /tmp/pipe and "select * into outfile
'/tmp/pipe'", but mysql complains about the file existing already.

Is there any other quick way to do this without having to write a
client app? Thanks in advance.
--
Yang Zhang
http://www.mit.edu/~y_z/

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: Dumping table contents to stdout in tab-separated value format

am 21.02.2010 04:35:18 von Carlos Proal

I dont know if this can help, but if you are on unix/linux you can call
cat after the dump and easily you can get the output to the stdout
ie:
$ mysqldump....tempfile.txt... && cat tempfile.txt

Carlos

On 2/20/2010 9:03 PM, Yang Zhang wrote:
> Hi, I'm interested in piping out the contents of a mysql table to
> stdout in tab-separated value format, but:
>
> - using 'select * into outfile' can't write to stdout.
> - mysqldump --fields-... requires --tab, which requires an output file path.
> - I also tried mkfifo /tmp/pipe and "select * into outfile
> '/tmp/pipe'", but mysql complains about the file existing already.
>
> Is there any other quick way to do this without having to write a
> client app? Thanks in advance.
>


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: Dumping table contents to stdout in tab-separated value format

am 21.02.2010 06:39:40 von Jesper Wisborg Krogh

--Apple-Mail-2-660772180
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
delsp=yes;
format=flowed

On 21/02/2010, at 2:03 PM, Yang Zhang wrote:

> Hi, I'm interested in piping out the contents of a mysql table to
> stdout in tab-separated value format, but:
>
> - using 'select * into outfile' can't write to stdout.
> - mysqldump --fields-... requires --tab, which requires an output
> file path.
> - I also tried mkfifo /tmp/pipe and "select * into outfile
> '/tmp/pipe'", but mysql complains about the file existing already.
>
> Is there any other quick way to do this without having to write a
> client app? Thanks in advance.

You can execute a query from the command line and use the -B (or --
batch) option.

mysql mysql -B -e "SELECT * FROM time_zone LIMIT 5"
Time_zone_id Use_leap_seconds
1 N
2 N
3 N
4 N
5 N


--Apple-Mail-2-660772180--

Re: Dumping table contents to stdout in tab-separated value format

am 21.02.2010 10:09:31 von ekilimchuk

--000e0cd1398aa94a2e048018ac7a
Content-Type: text/plain; charset=ISO-8859-1

Hello!
If you use *nix sistem. You can use the 'tail' utilit with -f flag.
In the first terminal you use: mysqldump or 'select * into outfile'.
In the second terminal you can use: tail -f file_name.
This is help for monitoring.

2010/2/21 Yang Zhang

> Hi, I'm interested in piping out the contents of a mysql table to
> stdout in tab-separated value format, but:
>
> - using 'select * into outfile' can't write to stdout.
> - mysqldump --fields-... requires --tab, which requires an output file
> path.
> - I also tried mkfifo /tmp/pipe and "select * into outfile
> '/tmp/pipe'", but mysql complains about the file existing already.
>
> Is there any other quick way to do this without having to write a
> client app? Thanks in advance.
> --
> Yang Zhang
> http://www.mit.edu/~y_z/
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=ekilimchuk@gmail.com
>
>


--
Best regards,

Eugene Kilimchuk

--000e0cd1398aa94a2e048018ac7a--