我從 Linux shell 運行 psql 命令。結果輸出看起來像一個表格:
Name Age
-----------------
John 24
但我想用逗號得到這樣的結果:
Name,Age
John,24
如何更改 shell 的輸出格式?我正在使用 Centos 5.5 和 postgresql 8.4。
答案1
=> \a
Output format is unaligned.
=> \f ,
Field separator is ",".
=> select 'John' "Name", 24 "Age";
Name,Age
John,24