Re: Copy entire file as one field

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-12-03 22:03:21
Message-ID: 1038953001.1419.1.camel@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Tue, 2002-12-03 at 19:48, Warren Massengill wrote:
> My database is pg, the table is mail.
> The small text files are in /home/kelly/message/.
> The bash shell script is merge.
>
> Somehow I failed to translate your instructions...
>
> -----------------------------------------------------
> #!/bin/bash
>
> for f in `ls /home/kelly/message*`
^^^^^^
message/*

> do
> psql -d pg -c "INSERT INTO mail (message)
> VALUES ('`cat $f`')"
> done

Your files are in that directory, so the wild card must be too.
--
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
========================================
"What shall we then say to these things? If God be for
us, who can be against us?" Romans 8:31

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Devinder K Rajput 2002-12-03 22:17:40 Re: Copy entire file as one field
Previous Message John Sklavounos 2002-12-03 21:57:06 Help! Lost functions