Обсуждение: Help: How to store query output in a file !!!

Поиск
Список
Период
Сортировка

Help: How to store query output in a file !!!

От
NEERAJ BANSAL
Дата:
Does anyone knows how do you send query output to a file???
I tried following but it does not work:
select * from <table name> \o <file name> ;

Please let me know if anyone knows!! Thanks in advance

Neeraj
neeraj_b@hotmail.com


Re: Help: How to store query output in a file !!!

От
selkovjr@mcs.anl.gov
Дата:
>
> Does anyone knows how do you send query output to a file???

Welcome to Unix(TM):

psql <database> -c "select * from <table name>, etc." > <file name>

See also:

http://www.isu.edu/departments/comcom/unix/workshop/io.html

or, type "unix tutorial" in any web search engine.

--Gene

> I tried following but it does not work:
> select * from <table name> \o <file name> ;
>
> Please let me know if anyone knows!! Thanks in advance
>
> Neeraj
> neeraj_b@hotmail.com


Re: Help: How to store query output in a file !!!

От
"Len Morgan"
Дата:
From psql:

test => \o <ouput-file-name>
test => <Enter your query here>
test => \o

This will leave the results of your query in the file "output-file-name"

This IS covered in the documentation and from within psql with \h

len morgan

-----Original Message-----
From: selkovjr@mcs.anl.gov <selkovjr@mcs.anl.gov>
To: NEERAJ BANSAL <nbansal1@email.mot.com>
Cc: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Date: Wednesday, June 14, 2000 2:46 AM
Subject: Re: [GENERAL] Help: How to store query output in a file !!!


>>
>> Does anyone knows how do you send query output to a file???
>
>Welcome to Unix(TM):
>
>psql <database> -c "select * from <table name>, etc." > <file name>
>
>See also:
>
>http://www.isu.edu/departments/comcom/unix/workshop/io.html
>
>or, type "unix tutorial" in any web search engine.
>
>--Gene
>
>> I tried following but it does not work:
>> select * from <table name> \o <file name> ;
>>
>> Please let me know if anyone knows!! Thanks in advance
>>
>> Neeraj
>> neeraj_b@hotmail.com
>
>