pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@commandprompt.com>
To: A.Burbello <burbello3000@yahoo.com.br>
Cc: Postgres Adm List <pgsql-admin@postgresql.org>
Subject: Re: Dump database more than 1 flat file
Date: Mon, 17 Dec 2007 22:05:11 -0300
Message-ID: <20071218010511.GE24103@alvh.no-ip.org> (raw)
In-Reply-To: <110808.75802.qm@web36204.mail.mud.yahoo.com>
References: <dcc563d10712171404tdb8b2e0h4f166d483c27d0cc@mail.gmail.com>
	<110808.75802.qm@web36204.mail.mud.yahoo.com>

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.



view thread (15+ messages)  latest in thread

Message-ID: <20071218010511.GE24103@alvh.no-ip.org>
Permalink:  ../20071218010511.GE24103@alvh.no-ip.org/
Also on:    postgresql.org/message-id/20071218010511.GE24103@alvh.no-ip.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: alvherre@commandprompt.com, burbello3000@yahoo.com.br
  Subject: Re: Dump database more than 1 flat file
  In-Reply-To: <20071218010511.GE24103@alvh.no-ip.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox