Better way to process records in bash?

From: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Better way to process records in bash?
Date: 2024-09-12 15:08:16
Message-ID: CANzqJaCaLwc6rOK7O8PkCgVDi_8fg6duzdUrMy0rtn_tQL144g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

(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!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2024-09-12 15:20:59 Re: post-bootstrap init : permission denied pg_description
Previous Message Durgamahesh Manne 2024-09-12 14:23:45 Re: Performance degrade on insert on conflict do nothing