absolute333
absolute333

Reputation: 81

blank line with psql in postgres. How could I remove it?

I do a simple query in Postgres and always shows me a blank line after the result. I need to remove these blank line because I make a cumulative report all days and the blank line must not appear. Here is an example code:

[user@machine ~/try]$ psql -t postgresql://user:pass@machine/conn << EOF
? SELECT version();
? EOF
 PostgreSQL 9.5.5 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3), 64-bit

[user@machine ~/try]$

Upvotes: 2

Views: 2559

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 246268

If you want psql to be quiet, tell it to be:

~> psql --no-align --tuples-only --quiet --command='SELECT version()'
PostgreSQL 11.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2), 64-bit
~>

Upvotes: 4

Related Questions