Re: Dump database more than 1 flat file - Mailing list pgsql-admin

From Alvaro Herrera
Subject Re: Dump database more than 1 flat file
Date
Msg-id 20071218010511.GE24103@alvh.no-ip.org
Whole thread Raw
In response to Re: Dump database more than 1 flat file  ("A.Burbello" <burbello3000@yahoo.com.br>)
Responses Re: Dump database more than 1 flat file
List pgsql-admin
A.Burbello wrote:

> If doesn't have another way, how can I put the
> "header" in the begin of file without open?
> With "cat >>" command I put in the end.

Don't -- you can put the header in a separate file and do something like

(cat header-file ; cat split-1 ; cat tail-file ) | psql

lather, rinse, repeat.  (Each split-N file would be an output file from
split).  I'm not sure if you also need the tail-file containing the \.
The parens tell the shell to execute all those commands and send the
output of all of them into the single psql process.

Of course you can automate it further, once you've copied all the DVDs
into a directory in the destination server:

for file in split-*; do
  ( cat header-file ; cat $file ; cat tail-file ) | psql
done

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

pgsql-admin by date:

Previous
From: "Phillip Smith"
Date:
Subject: Re: Dump database more than 1 flat file
Next
From: "Tena Sakai"
Date:
Subject: Re: How would I "close" a atble?