Re: Copy entire file as one field

From: "Warren Massengill" <warrenmassengill(at)hotmail(dot)com>
To: Devinder(dot)Rajput(at)ipaper(dot)com
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Copy entire file as one field
Date: 2002-12-04 19:08:50
Message-ID: F86309R72LC5Viggqx4000065d3@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


>From: "Devinder K Rajput" <Devinder(dot)Rajput(at)ipaper(dot)com>
>
>What error msg do you get after you change the name of the script?
>
>Devinder

Sorry, I should have said that the revised script (merge4) error message was
shown below...
--------------------------------------
[kelly(at)localhost pg]$ merge4
bash: merge4: command not found
--------------------------------------
Thanks,
Warren
>
>The revised version has the same result. If I change the name of the script
>(another poster suggested avoiding the reserved word 'merge') there is a
>different error message.
>
>Thanks,
>Warren
>
>------------------------------------
>#!/bin/bash
>
>for f in `ls /home/kelly/message/*`
>do
> psql -d pg -c "INSERT INTO mail (message)
> VALUES ('`cat $f`')"
>done
>
>-------------------------------------
>[kelly(at)localhost pg]$ merge
>merge: not enough arguments
>merge: usage: merge [-AeEpqxX3] [-L lab [-L lab [-L lab]]] file1 file2
>file3
>merge aborted
>--------------------------------------
>[kelly(at)localhost pg]$ merge4
>bash: merge4: command not found
>--------------------------------------
> >
> >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.
> > > -----------------------------------------------------
> > > #!/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

_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8.
http://join.msn.com/?page=features/junkmail

Browse pgsql-novice by date

  From Date Subject
Next Message Devinder K Rajput 2002-12-04 19:10:57 Re: Copy entire file as one field
Previous Message Devinder K Rajput 2002-12-04 18:56:46 Re: Copy entire file as one field