echo "SELECT firstname,lastname FROM user WHERE lastname='Newland'" | psql -Uphp -h dbserver userdb > /tmp/query_results.txt