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

From Warren Massengill
Subject Re: Copy entire file as one field
Date
Msg-id F97grKQ2CxuP5fEYq9I00003c66@hotmail.com
Whole thread Raw
In response to Copy entire file as one field  ("Warren Massengill" <warrenmassengill@hotmail.com>)
List pgsql-novice
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@localhost pg]$ ./merge
: bad interpreter: No such file or directory
[kelly@localhost pg]$ ./merge4
: bad interpreter: No such file or directory
--------------------------------------
[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]$
--------------------------------------

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@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.

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail


pgsql-novice by date:

Previous
From: "Devinder K Rajput"
Date:
Subject: Re: Copy entire file as one field
Next
From: Tom Lane
Date:
Subject: Re: Vacuum full error No one parent tuple