Re: Dump database more than 1 flat file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

                http://www.postgresql.org/about/donate

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux