Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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:

   Name,Age
   John,24

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 stackoverflow.com Feb 26 '13 at 15:38

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

1 Answer 1

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

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.