psql copy from through bash

From: Kirk Wythers <kwythers(at)umn(dot)edu>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: psql copy from through bash
Date: 2013-01-11 18:13:15
Message-ID: 044EFA84-2036-49F5-8ACE-7B75F112011B@umn.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Can anyone see what I'm misisng? I am trying to run a psql "copy from" command through a bash script to load a buch of cdv files into the same table. I'm getting an error about the file "infile" not existing?

#!/bin/sh

for infile in /path_to_files/*.csv
do
cat infile | psql dbname -c "\copy table_name FROM stdin with delimiter as ',' NULL AS 'NA' CSV HEADER"
done

Thanks in advance

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Szymon Guz 2013-01-11 18:18:55 Re: psql copy from through bash
Previous Message Gavin Flower 2013-01-11 17:49:37 Re: [postgis-users] Query with LIMIT but as random result set?