From: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
---|---|
To: | "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Need regexp_replace help |
Date: | 2013-02-14 21:42:45 |
Message-ID: | CAHyXU0x99-_G0eMeF9nKdv9+=o81_v31xUHN7R9K=WLWc5v=Kw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Feb 14, 2013 at 3:37 PM, Gauthier, Dave <dave(dot)gauthier(at)intel(dot)com> wrote:
> Trying ( and failing) to get this to run...
>
>
>
> select regexp_replace(pg_get_functiondef(proname::regproc),E'[
> ]+\\+\n','\n') from pg_proc where proname = 'maketime';
>
>
>
> Goal is to remove the space padding and the "+" at the end of each line in
> the dump of pg_get_functiondef, something that could actually be run if sent
> out to a file (\o) and then read into another DB (\i). Of course the ";"
> would have to be appended at the end, but I can manage that :-)
this isn't a regex issue, but a psql one. Just disable alignment
and set tuples only etc. Whenever I do this type of thing (intend
psql output to some consumer), it's:
psql -XtAqc "query" > file
there are similar options to do this via various \set commands.
merlin
From | Date | Subject | |
---|---|---|---|
Next Message | Noah Misch | 2013-02-14 22:59:57 | Re: BUG #7493: Postmaster messages unreadable in a Windows console |
Previous Message | Gauthier, Dave | 2013-02-14 21:37:02 | Need regexp_replace help |