public inbox for [email protected]  
help / color / mirror / Atom feed
From: Ron Johnson <[email protected]>
To: pgsql-general <[email protected]>
Subject: Better way to process records in bash?
Date: Thu, 12 Sep 2024 11:08:16 -0400
Message-ID: <CANzqJaCaLwc6rOK7O8PkCgVDi_8fg6duzdUrMy0rtn_tQL144g@mail.gmail.com> (raw)

(This might be a bash question instead of a PG question, or it might be an
A/B question.)

I need to process table records in a bash script.  Currently, I read them
using a while loop and redirection.  The table isn't that big (30ish
thousand rows), and performance is adequate, but am always looking for
"better".

Here's the current code:
declare f1 f3 f8
while IFS='|' read f1 f3 f8; do
    something f8 f3 f1
done < <(psql -XAt -c "select f1, f3, f8 from some.table_name;")

-- 
Death to America, and butter sauce.
Iraq lobster!


view thread (2+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: Better way to process records in bash?
  In-Reply-To: <CANzqJaCaLwc6rOK7O8PkCgVDi_8fg6duzdUrMy0rtn_tQL144g@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox