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

From Devinder K Rajput
Subject Re: Copy entire file as one field
Date
Msg-id OF9A5B6439.1635219A-ON86256C85.00659F70@ipaper.com
Whole thread Raw
In response to Copy entire file as one field  ("Warren Massengill" <warrenmassengill@hotmail.com>)
List pgsql-novice
What error msg do you get after you change the name of the script?

Devinder



                    
                      "Warren Massengill"
                    
                      <warrenmassengill@hotm        To:       olly@lfix.co.uk
                    
                      ail.com>                      cc:       pgsql-novice@postgresql.org
                    
                      Sent by:                      Subject:  Re: [NOVICE] Copy entire file as one field
                    
                      pgsql-novice-owner@pos
                    
                      tgresql.org
                    

                    

                    
                      12/04/2002 12:16 PM
                    

                    

                    





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@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.
>--
>Oliver Elphick                                Oliver.Elphick@lfix.co.uk


_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org







pgsql-novice by date:

Previous
From: "Warren Massengill"
Date:
Subject: Re: Copy entire file as one field
Next
From: Ron Johnson
Date:
Subject: Re: Copy entire file as one field