Re: Copy entire file as one field - Mailing list pgsql-novice

From Ron Johnson
Subject Re: Copy entire file as one field
Date
Msg-id 1039027252.8776.25.camel@haggis
Whole thread Raw
In response to Re: Copy entire file as one field  ("Warren Massengill" <warrenmassengill@hotmail.com>)
List pgsql-novice
On Wed, 2002-12-04 at 12:16, Warren Massengill wrote:
> 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.


You *must* run your script this way:
$ ./merge4

And you did make sure that the script is executable, right?

> ------------------------------------
> #!/bin/bash
>
> for f in `ls /home/kelly/message/*`
> do
>         psql -d pg -c "INSERT INTO mail (message)
>                                  VALUES ('`cat $f`')"
> done
>
> -------------------------------------
> [kelly@localhost pg]$ merge
> merge: not enough arguments
> merge: usage: merge [-AeEpqxX3] [-L lab [-L lab [-L lab]]] file1 file2 file3
> merge aborted
> --------------------------------------
> [kelly@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.
> > >
> > > 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.
> >--

--
+------------------------------------------------------------+
| Ron Johnson, Jr.     mailto:ron.l.johnson@cox.net          |
| Jefferson, LA  USA   http://members.cox.net/ron.l.johnson  |
|                                                            |
| "they love our milk and honey, but preach about another    |
|  way of living"                                            |
|    Merle Haggard, "The Fighting Side Of Me"                |
+------------------------------------------------------------+


pgsql-novice by date:

Previous
From: "Devinder K Rajput"
Date:
Subject: Re: Copy entire file as one field
Next
From: "Devinder K Rajput"
Date:
Subject: Re: Copy entire file as one field