如何在shell中更改输出模式?

Sai*_*Aye 0 shell postgresql psql

我从 Linux shell 运行 psql 命令。结果输出看起来像一个表格:

  Name         Age
  -----------------
  John          24
Run Code Online (Sandbox Code Playgroud)

但我想用这样的逗号得到结果:

   Name,Age
   John,24
Run Code Online (Sandbox Code Playgroud)

如何从 shell 更改输出格式?我使用 Centos 5.5 和 postgresql 8.4。

小智 6

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

=> select 'John' "Name", 24 "Age";
Name,Age
John,24
Run Code Online (Sandbox Code Playgroud)