Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kkpRc-0006FZ-Lr for pgsql-general@arkaria.postgresql.org; Thu, 03 Dec 2020 14:18:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kkpRa-0003u9-Rc for pgsql-general@arkaria.postgresql.org; Thu, 03 Dec 2020 14:18:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kkpRa-0003u2-Ji for pgsql-general@lists.postgresql.org; Thu, 03 Dec 2020 14:18:50 +0000 Received: from mail.verite.pro ([185.16.44.216]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kkpRX-00071K-Sa for pgsql-general@postgresql.org; Thu, 03 Dec 2020 14:18:50 +0000 Received: from sd-76392.dedibox.fr (195-154-133-58.rev.poneytelecom.eu [195.154.133.58]) by mail.verite.pro (Postfix) with ESMTP id 16F018C012A; Thu, 3 Dec 2020 15:08:45 +0100 (CET) Received: by sd-76392.dedibox.fr (Postfix, from userid 1000) id 1AF4D2240203; Thu, 3 Dec 2020 15:18:46 +0100 (CET) Content-Type: text/plain; charset="iso-8859-15" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 From: "Daniel Verite" Subject: Re: psql > split > queries & output To: wim.bertels@ucll.be Cc: "pgsql-general" In-Reply-To: <73c574f0b615a1bff6d6ce48f7ba520a7bd749d5.camel@ucll.be> Date: Thu, 03 Dec 2020 15:18:42 +0100 Message-Id: X-Mailer: Manitou v1.7.3 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Wim Bertels wrote: > * one pipe (or..) to a file which only contains the statements > (queries) history (and not the output) > * another pipe (or..) to a file which only contains the output (with or > without the statements) history Consider that script: $ cat f.sql \set ECHO queries \o output.txt select 1; select 2; select 3; If it's run with $ psql -f f.sql >queries.txt then it produces the queries in queries.txt and the output in output.txt Best regards, --=20 Daniel V=E9rit=E9 PostgreSQL-powered mailer: https://www.manitou-mail.org Twitter: @DanielVerite