From: | "Devinder K Rajput" <Devinder(dot)Rajput(at)ipaper(dot)com> |
---|---|
To: | "Warren Massengill" <warrenmassengill(at)hotmail(dot)com> |
Cc: | pgsql-novice(at)postgresql(dot)org, pgsql-novice-owner(at)postgresql(dot)org, ron(dot)l(dot)johnson(at)cox(dot)net |
Subject: | Re: Copy entire file as one field |
Date: | 2002-12-04 20:30:18 |
Message-ID: | OF444280E6.1528C7D0-ON86256C85.006FCCEC@ipaper.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
from the error messages it seems that it can not the bash shell. One thing
to try is
$ which bash
and see if returns with the location or just try running the following one
liner from the command line:
for f in `ls /home/kelly/message/*`;do psql -d pg -c "INSERT INTO mail
(message) VALUES ('`cat $f`')"; done
Devinder Rajput
Stores Division Corporate Offices
Chicago, IL
(773) 442-6474
"Warren Massengill"
<warrenmassengill(at)hotm To: ron(dot)l(dot)johnson(at)cox(dot)net
ail.com> cc: pgsql-novice(at)postgresql(dot)org
Sent by: Subject: Re: [NOVICE] Copy entire file as one field
pgsql-novice-owner(at)pos
tgresql.org
12/04/2002 02:10 PM
I'm still missing something.....
Two identical files: merge and merge4; both executable by the world.
------------------------------------
$ ./merge or $ ./merge4
cannot find the file
------------------------------------
$ merge
apparently locates the file -- but cannot run it
------------------------------------
-rw------- 1 kelly kelly 3062 Dec 3 11:57 logfile
-rwxrwxrwx 1 kelly kelly 135 Dec 3 13:24 merge
-rwxrwxrwx 1 kelly kelly 135 Dec 3 10:54 merge4
drwx------ 2 kelly kelly 4096 Dec 2 04:31 pg_clog
-rw------- 1 kelly kelly 10168 Dec 2 04:31 pg_hba.conf
-rw------- 1 kelly kelly 1250 Dec 2 04:31 pg_ident.conf
-rw------- 1 kelly kelly 4 Dec 2 04:31 PG_VERSION
drwx------ 2 kelly kelly 4096 Dec 2 04:31 pg_xlog
-rw------- 1 kelly kelly 3848 Dec 2 04:31 postgresql.conf
-rw------- 1 kelly kelly 20 Dec 3 10:51 postmaster.opts
--------------------------------------
[kelly(at)localhost pg]$ ./merge
: bad interpreter: No such file or directory
[kelly(at)localhost pg]$ ./merge4
: bad interpreter: No such file or directory
--------------------------------------
[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]$
--------------------------------------
Thanks,
Warren
>
>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(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.
_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
From | Date | Subject | |
---|---|---|---|
Next Message | Oliver Elphick | 2002-12-04 20:39:48 | Re: Yet one more stupid question |
Previous Message | Patrick Hatcher | 2002-12-04 20:25:28 | Re: Vacuum full error No one parent tuple |