Skip site navigation (1) Skip section navigation (2)

Re: Redirecting output from a SELECT command

From: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Redirecting output from a SELECT command
Date: 2010-11-11 18:42:12
Message-ID: 20101111184212.GA18518@tux (view raw or flat)
Thread:
Lists: pgsql-novice
peter(at)vfemail(dot)net <peter(at)vfemail(dot)net> wrote:

> 
> >From a shell prompt in FreeBSD, I can use a command like:
> 
>     cat file.txt | mail email(at)domain(dot)com 
> 
> to e-mail the contents of a file somewhere.  
> 
> Is it possible from a PostgreSQL pgsql> shell prompt to e-mail the results of a:
> 
>     select * from table; 
> 
> command somewhere?  

Sure.

psql db_name -c "select * from table" | mail email(at)domain(dot)com



Andreas
-- 
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."   (unknown)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

In response to

Responses

pgsql-novice by date

Next:From: peterDate: 2010-11-11 18:58:53
Subject: Re: Redirecting output from a SELECT command
Previous:From: Richard BroersmaDate: 2010-11-11 18:15:52
Subject: Re: CSVLOG fields

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group