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 1m5Xa8-0007DR-O7 for pgsql-general@arkaria.postgresql.org; Mon, 19 Jul 2021 18:01:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m5Xa7-0006Ma-FA for pgsql-general@arkaria.postgresql.org; Mon, 19 Jul 2021 18:01:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m5Xa7-0006MR-4N for pgsql-general@lists.postgresql.org; Mon, 19 Jul 2021 18:01:31 +0000 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1m5Xa1-00045D-UQ for pgsql-general@lists.postgresql.org; Mon, 19 Jul 2021 18:01:29 +0000 Received: by mail-pl1-x62a.google.com with SMTP id y3so5600171plp.4 for ; Mon, 19 Jul 2021 11:01:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=NXC2z9E1mC9cY0HRFtzIkfm0/sMR6njIySrvkyqxGrg=; b=C7Gjo8oJ1SsZETSI5822cpKm6DolY/q1M4RZmfxsrfo5Gp9DXtPvCh/aieE7yMEFOK Ak4RT28h0vsBzFi4OcwNpa42aYZ/G4PGeTbppDzhLyyQ74Uvo5uvz19JzzCG8EiuLf83 CpN3i4LE7ouvHrWChOjJaIxe3HzSMgrmdWcX8Vf3rx607Rj8hJV9YQQwH9cQf3yTG9j4 bgcgnKLx41dKoA7QN8saWgkPl24FkjQLb8rOMI0Y5oDGBilu9HjTrxhgB+vQxbO4UJWk xYkV/7MK1kGhVDP7Q2tNLUcoobSJSZ/jflb6jkdXk1yWKItBuOfLZNsbl8Jq3qslZFpa tMrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=NXC2z9E1mC9cY0HRFtzIkfm0/sMR6njIySrvkyqxGrg=; b=KEevj9B5HVNczt5ZXfGlZK4lcgcmmIQDRiNXZC8Qgh9R86XqVlB3U4fXsO46uTJrGj NDil+ajk242+WjhpNQbUJ+gkiPp6kr4KdIXvUZ9F33+mctbE1N48D3vosdD1K7YlHY1Q o+kLeo5XSl2re09+MMEENuVWY0Dx1HsqMtyyWnpN8VC6mTu47RmPFffMmPULLeRW7DrQ hQmu9Q9dmIoMHPBFMVncnlTk3PUo1hk9k9x7lMxB+fQrEPFNiK/X3qTASiZG7fkoLAkm oRB+WKfEIHeMeu+oud92iPpWUsX2T7AUjtcAOOFABJu+YOqoPOcA1meladjuDE2JOUau XPCw== X-Gm-Message-State: AOAM530cr021RLSrz5H0Jl1z9z2M26m+nocF8Gu4Q1V+aDB1bdLtturl vw3zMA5SyWjdhFDXXGErlKo= X-Google-Smtp-Source: ABdhPJyqKYOOJE7e/g4kU+//tWi6VVLXDpqzrexIB7JbWiKPvIroy4CTkE6dBMOvkOTixH0Dt/90gA== X-Received: by 2002:a17:90a:5218:: with SMTP id v24mr25881424pjh.47.1626717684688; Mon, 19 Jul 2021 11:01:24 -0700 (PDT) Received: from smtpclient.apple ([155.98.131.7]) by smtp.gmail.com with ESMTPSA id d2sm20964512pfa.84.2021.07.19.11.01.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Jul 2021 11:01:24 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: Formating psql query output From: Rob Sargent In-Reply-To: <4f001abb-7f6d-d098-ed10-1c5445c0ba1c@aklaver.com> Date: Mon, 19 Jul 2021 12:01:22 -0600 Cc: Rich Shepard , pgsql-general@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <8DC70752-D1F1-4841-8E68-C7103764B144@gmail.com> References: <4f001abb-7f6d-d098-ed10-1c5445c0ba1c@aklaver.com> To: Adrian Klaver X-Mailer: Apple Mail (2.3654.100.0.2.22) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Jul 19, 2021, at 11:49 AM, Adrian Klaver = wrote: >=20 > On 7/19/21 10:33 AM, Rich Shepard wrote: >> Until I finish building the python/tkinter/psycopg2 front end to my = business >> tracking tool I continue to work using the psql shell.' >> I have a working .sql script that reports my contacts between two = dates; the >> script returns more columns than I want included in the report. I = want to >> pipe the output through an awk script to extract, in order, the = columns I >> need. I'm stuck at the point of defining options to psql. >=20 > Is there a reason you can't just restrict the query to the columns you = want? >=20 Also had that thought but OP is wise to head the other switches for = cleaner output. But also should probably get familiar with to-json = options as well for easy pickup on the eventual client.