From: | "Basques, Bob (CI-StPaul)" <bob(dot)basques(at)ci(dot)stpaul(dot)mn(dot)us> |
---|---|
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> |
Subject: | RE: Formating psql query output |
Date: | 2021-07-19 17:41:24 |
Message-ID: | DM8PR09MB634240AB2B28E3EED80F6F48F7E19@DM8PR09MB6342.namprd09.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
From here: https://www.postgresql.org/docs/9.2/app-psql.html
-F separator
--field-separator=separator
Use separator as the field separator for unaligned output. This is equivalent to \pset fieldsep or \f.
Bobb
> -----Original Message-----
> From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
> Sent: Monday, July 19, 2021 12:33 PM
> To: pgsql-general(at)lists(dot)postgresql(dot)org
> Subject: Formating psql query output
>
> Think Before You Click: This email originated outside our organization.
>
>
> Until I finish building the python/tkinter/psycopg2 front end to my business
> tracking tool I continue to work using the psql shell.'
>
> I have a working .sql script that reports my contacts between two dates; the
> script returns more columns than I want included in the report. I want to pipe
> the output through an awk script to extract, in order, the columns I need. I'm
> stuck at the point of defining options to psql.
>
> The current command line is:
> psql -d bustrac -f prospecting_log.sql -o contacts.txt --csv
>
> However, using the --csv output conversion makes separate fields from a
> varchar column that can contain commas with the text contents.
>
> Without --csv I get normal psql output with column headings and separator
> lines such as these:
> person_nbr | act_date | act_type |
> notes
> | person_nbr | lname | fname | org_nbr | org_nbr | org_name
> ------------+------------+-----------+------------------------------------------------------
> ----------------------------------------------------------------------------------------------
> ----------------------------------------------------------------------------------------------
> ----------------------------------------------------------------------------------------------
> ---------------------------------+------------+------------------+------------+---------+--
> -------+----------------------
>
> 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.
>
> TIA,
>
> Rich
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | David Santamauro | 2021-07-19 17:42:03 | Re: Formating psql query output |
Previous Message | Rich Shepard | 2021-07-19 17:33:02 | Formating psql query output |