In PostgreSQL database it is possible to save / export and results of a database query to a simple text file. By default all query result are displayed on the screen. This default behavior can be overwritten by \o command:

postresql=> \o /path/to/your/text/file.txt
postresql=> postgresql query ( here place your query )
postresql=> \o ( set back the default output behavior )

ARE YOU LOOKING FOR A LINUX JOB?
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed on LinuxCareers.com.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.

You may also be interested in: