Stream psql query

How to stream on a file the query result of postgres

Using psql for query the Postgres database it's very usefoul to use a command that let you write the result query on a file.
1) Enter in psql on your prefered database:
2) Use the \o myquery.txt
3) use the select statment es: select  name from product_product where name like '&abc';
4) \o
in this way teh result of oyur select will be redirected to the myquery.txt file.
hope you will enjoy it .. we averyday dose :)