Re: Shell script to extract a table from a plain text dump

From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: Shell script to extract a table from a plain text dump
Date: 2005-10-08 07:52:52
Message-ID: 43477AD4.9000905@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Argh! That's some sed coolness :)

Chris

Martijn van Oosterhout wrote:
> On Fri, Oct 07, 2005 at 04:46:12PM +0800, Christopher Kings-Lynne wrote:
>
>>If you have huge plain text dumps, and just want to restore one table
>>it's usually painful. Attached is a small shell script that can take a
>>plain text dump and extract a single table's COPY data commands from it.
>>
>>If people think it's interesting and should be developed, I can pop it
>>on pgfoundry or something.
>
>
> Hmm, what I usually use is:
>
> bzcat $file | sed -ne "/^COPY \"$table\" /,/^\\\.\$/p"
>
> However, error checking and wrapping it into a script is a good idea.
> If it got given a couple of switches to control the output, maybe we
> can have a pg_restore for text dumps :)
>
> Have a nice day,

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Kretschmer 2005-10-08 08:34:45 Re: Oracle buys Innobase
Previous Message Michael Fuhr 2005-10-08 02:35:44 Re: SELECT FOR SHARE and FOR UPDATE

Browse pgsql-hackers by date

  From Date Subject
Next Message Atsushi Ogawa 2005-10-08 09:15:10 Re: Reuse the dead item on unique index.
Previous Message sandeep satpal 2005-10-08 07:18:50 Re: Issue is changing _bt_compare function and