Formatting the output

Started by G. Anthony Reinaover 26 years ago7 messages
#1G. Anthony Reina
reina@nsi.edu

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

#2Bill Brandt
brandtwr-pgsql@draaw.net
In reply to: G. Anthony Reina (#1)
Re: [SQL] Formatting the output

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/

#3Bruce Momjian
maillist@candle.pha.pa.us
In reply to: G. Anthony Reina (#1)
Re: [SQL] Formatting the output

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 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.

-- 
  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, Pennsylvania 19026
#4Bruce Momjian
maillist@candle.pha.pa.us
In reply to: G. Anthony Reina (#1)
Re: [SQL] Formatting the output

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, Pennsylvania 19026
#5G. Anthony Reina
reina@nsi.edu
In reply to: G. Anthony Reina (#1)
Re: [SQL] Formatting the output

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

#6Thomas Lockhart
lockhart@alumni.caltech.edu
In reply to: Bruce Momjian (#4)
Re: [SQL] Formatting the output

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

#7Bruce Momjian
maillist@candle.pha.pa.us
In reply to: Thomas Lockhart (#6)
Re: [SQL] Formatting the output

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, Pennsylvania 19026