Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I run the psql command from a Linux shell. The resulting output looks like a table:

  Name         Age
  John          24

But I would like to get the result with commas like this:


How do I change the output format from the shell? I'm using Centos 5.5 and postgresql 8.4.

share|improve this question

migrated from Feb 26 '13 at 15:38

This question came from our site for professional and enthusiast programmers.

up vote 5 down vote accepted
=> \a
Output format is unaligned.
=> \f ,
Field separator is ",".

=> select 'John' "Name", 24 "Age";
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .