How to change output pattern in shell?

0

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.

Sai Ye Yan Naing Aye

Posted 2013-02-26T10:38:03.817

Reputation: 121

Answers

6

=> \a
Output format is unaligned.
=> \f ,
Field separator is ",".

=> select 'John' "Name", 24 "Age";
Name,Age
John,24

Clodoaldo

Posted 2013-02-26T10:38:03.817

Reputation: 229