How to output psql to file AND screen/console

From: Edwin UY <edwin(dot)uy(at)gmail(dot)com>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: How to output psql to file AND screen/console
Date: 2024-02-07 09:16:44
Message-ID: CA+wokJ-wsGnJJfOJz4cgvQyXuBJSdyWiTCd7pTKuR3ugbs5yNw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi,

Is there any way for psql to output to the console AND file at the same
time?
\o redirect the output to the file but at the same time it suppresses the
output to the console :(

I am wanting to redirect the output to a file for the psql session for the
SQL/SQL-script that I ran while at the same see the same output to screen.

Thought I can use tee -a but I can't :(
Using script [outputfile] seems to work. Just thought maybe there is any
other psql trick besides using script. The script has lots of control
characters :(

Thanks in advance.

Regards,
Edwin

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Erik Wienhold 2024-02-07 10:11:10 Re: How to output psql to file AND screen/console
Previous Message David G. Johnston 2024-02-06 16:46:09 Re: psql du command