]OT] Parsing postgresql.conf archive_command

From: "Joey K(dot)" <pguser(at)gmail(dot)com>
To: "General PostgreSQL List" <pgsql-general(at)postgresql(dot)org>
Subject: ]OT] Parsing postgresql.conf archive_command
Date: 2008-10-03 13:05:32
Message-ID: 467669b30810030605x79d595c4m49827a35e2f3129a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

I'd like to get the path configured for archive_command in a shell script

I've used a file with following content as an example (postgresql.conf),

# archive_command = cp %p /backup/%r
# archive_command = cp %p /backup/%r
# archive_command = cp %p /backup/%r
#archive_command = cp %p /backup/%r
archive_command = 'cp %p /backup/wal/%f'

This is what I been trying.
$ awk '!/[ \t]*#/ { sub(/%f$/, "", $NF); print $NF }' postgresql.conf

and I get
/backup/wal/%f'

Any idea how to get rid of "%f'" so that I get only?
/backup/wal/

My regexp skills are sad :-)

Steve

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rob Richardson 2008-10-03 13:52:49 Re: How do I save data and then raise an exception?
Previous Message Anderson dos Santos Donda 2008-10-03 13:05:23 INITDB in VISTA