At 11:13 +1000 1/17/02, Mr Aaron Brandis wrote:
>Hi everyone
>
>This is the first time I have posted to this list and I was wondering if
>someone could answer my question.  I know you can run commands from a
>shell prompt (such as unix...) like:
>
>shell> mysql -e 'SELECT * FROM table' database
>
>for a simple select query and
>
>shell> mysqlimport --local database table.txt
>
>to import information from a text file. 
>
>I was just wondering how (and even if you can) set up a pager and write
>to a file from the shell.  I can do it from the mysql command prompt
>like this:
>
>mysql> pager cat /home/aaron/tube.txt;
>mysql> select Run from tubes;
>
>This will put the result of the query into tubes.txt  So does anyone
>know if i can do this from the shell prompt??

Writing to a file and paging the output are normally mutually exclusive
activities.  Why do you want to do this?

If you just want to save the output in a file, you don't need to use
a pager.  Just do this:

mysql -e 'select Run from tubes' database > /home/aaron/tube.txt

And if you want the usual boxed-table output (rather than tab-delimited,
which is what you normally get when redirecting the output to a file),
do this instead:

mysql -t -e 'select Run from tubes' database > /home/aaron/tube.txt


>
>Thanks alot for your help
>
>Aaron


---------------------------------------------------------------------
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

Reply via email to