From: | Oliver Elphick <olly(at)lfix(dot)co(dot)uk> |
---|---|
To: | Warren Massengill <warrenmassengill(at)hotmail(dot)com> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Copy entire file as one field |
Date: | 2002-11-28 07:43:12 |
Message-ID: | 1038469391.13294.319.camel@linda.lfix.co.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
On Thu, 2002-11-28 at 00:40, Warren Massengill wrote:
> How can I copy several hundred small text files into a database, each file
> going into a field called 'message' and becomming one record (with or
> without other fields) using psql?
A bit of shell scripting:
for f in `ls small_file*`
do
psql -d mydatabase -c "INSERT INTO mytable (message)
VALUES ('`cat $f`')"
done
--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight, UK http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"The earth is the LORD'S, and the fullness thereof; the
world, and they that dwell therein." Psalms 24:1
From | Date | Subject | |
---|---|---|---|
Next Message | HK | 2002-11-28 11:36:43 | 'now' doesnt seem to work in stored procedure |
Previous Message | etsuko shimabukuro | 2002-11-28 04:50:47 | user defined function |