Re: Formating psql query output

From: David Santamauro <david(dot)santamauro(at)gmail(dot)com>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Cc: GMAIL <david(dot)santamauro(at)gmail(dot)com>
Subject: Re: Formating psql query output
Date: 2021-07-19 17:42:03
Message-ID: BL0PR02MB47060457028EC865DB81CEB2FCE19@BL0PR02MB4706.namprd02.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
Date: Monday, July 19, 2021 at 1:33 PM

> Is there an option that will retain the '|' separator but exclude the headings?
> Reading the psql document page I don't see such an option.

echo 'select 1,2,3,4;' | psql -At -F'|'

1|2|3|4

-A Switches to unaligned output mode. (The default output mode is aligned.) This is equivalent to \pset format unaligned.
-t Turn off printing of column names and result row count footers, etc. This is equivalent to \t or \pset tuples_only.
-F Use separator as the field separator for unaligned output. This is equivalent to \pset fieldsep or \f.

HTH

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2021-07-19 17:49:34 Re: Formating psql query output
Previous Message Basques, Bob (CI-StPaul) 2021-07-19 17:41:24 RE: Formating psql query output