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:

[[email protected] ~/try]$ psql -t postgresql://user:[email protected]/conn << EOF
? SELECT version();
 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

[[email protected] ~/try]$

1 Answers

Laurenz Albe On Best Solutions

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