Обсуждение: Formatting the output

Поиск
Список
Период
Сортировка

Formatting the output

От
"G. Anthony Reina"
Дата:
Is there a way that I can supress the column heading and the "(# rows)"
which come before and after the following psql command:

psql -e db01 -c "select tablename from pg_tables where tablename NOT
LIKE 'pg%'"


The current output is:

tablename
=======
table1
table2
table3
table4
(4 rows)

What I'd like to get is simply:

table1
table2
table3
table4


Thanks.
-Tony




Re: [SQL] Formatting the output

От
Bill Brandt
Дата:
Try:

psql db01 -c "select tablename from pg_tables where tablename NOT LIKE '%pg%'" -t

The -e makes it display the QUERY: <whatever> line... so removing it fixes that
problem... the -t tells it not to show the column headings and such...

Bill

On Thu, Jul 29, 1999 at 10:02:13AM -0700, G. Anthony Reina wrote:
>Is there a way that I can supress the column heading and the "(# rows)"
>which come before and after the following psql command:
>
>psql -e db01 -c "select tablename from pg_tables where tablename NOT
>LIKE 'pg%'"
>
>
>The current output is:
>
>tablename
>=======
>table1
>table2
>table3
>table4
>(4 rows)
>
>What I'd like to get is simply:
>
>table1
>table2
>table3
>table4
>
>
>Thanks.
>-Tony
>
>
>

-- 
Liam

Bill Brandt                                   
brandtwr@draaw.net                              http://www.draaw.net/


Re: [SQL] Formatting the output

От
Bruce Momjian
Дата:
> Is there a way that I can supress the column heading and the "(# rows)"
> which come before and after the following psql command:
> 
> psql -e db01 -c "select tablename from pg_tables where tablename NOT
> LIKE 'pg%'"

How about psql -qt:#$ sql -qt testselect * from pg_language;internal|f      |f           |            0|n/a
lisp   |f      |f           |            0|/usr/ucb/lisztC       |f      |f           |            0|/bin/cc       sql
  |f      |f           |            0|postgres      
 

The manual page says -q turns off row count, but -t does.  I will fix
that now.

--  Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


Re: [SQL] Formatting the output

От
Bruce Momjian
Дата:
Thomas, please change the psql manual page to say -t turns off headings
and the row count, and change -q to not mention turning off of row
count, ok?  I believe you are controlling the master manual pages
copies.


--  Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


Re: [SQL] Formatting the output

От
"G. Anthony Reina"
Дата:
Bill Brandt wrote:

> Try:
>
> psql db01 -c "select tablename from pg_tables where tablename NOT LIKE '%pg%'" -t
>
> The -e makes it display the QUERY: <whatever> line... so removing it fixes that
> problem... the -t tells it not to show the column headings and such...
>

Bruce Momjian wrote:

> How about psql -qt:
>
>         #$ sql -qt test
>         select * from pg_language;
>         internal|f      |f           |            0|n/a
>         lisp    |f      |f           |            0|/usr/ucb/liszt
>         C       |f      |f           |            0|/bin/cc
>         sql     |f      |f           |            0|postgres
>
> The manual page says -q turns off row count, but -t does.  I will fix
> that now.
>

Thanks. That works fine.

-Tony




Re: [SQL] Formatting the output

От
Thomas Lockhart
Дата:
> Thomas, please change the psql manual page to say -t turns off headings
> and the row count, and change -q to not mention turning off of row
> count, ok?  I believe you are controlling the master manual pages
> copies.

Sure. Although I forgot to mention it explicitly, I've completed the
merge of the old man page info into the newer sgml pages. From here on
I'm just making small tweaks to get the man page stuff actually
working (have had to dive into perl code to get the cross references
to work).

So, feel free to touch those files yourself if you would like, but let
me know if you want me to do it.
                     - Thomas

-- 
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, California


Re: [SQL] Formatting the output

От
Bruce Momjian
Дата:
> > Thomas, please change the psql manual page to say -t turns off headings
> > and the row count, and change -q to not mention turning off of row
> > count, ok?  I believe you are controlling the master manual pages
> > copies.
> 
> Sure. Although I forgot to mention it explicitly, I've completed the
> merge of the old man page info into the newer sgml pages. From here on
> I'm just making small tweaks to get the man page stuff actually
> working (have had to dive into perl code to get the cross references
> to work).
> 
> So, feel free to touch those files yourself if you would like, but let
> me know if you want me to do it.

No problem.  Done.

--  Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026