Re: Dump and Query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andy Shellam (Mailing Lists) wrote:
Hi Enrico,

The following command will get you a text file of your result-set:

# echo "SELECT customer_id, first_name, sur_name FROM users;"|/usr/local/pgsql/bin/psql -U [username] -d [database] > myfile.txt
# cat myfile.txt

Alternative version:

psql -d <your dbname> -c "SELECT customer_id, first_name, sur_name FROM users" -o myfile.txt


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux