| From: | David Johnston <polobo(at)yahoo(dot)com> | 
|---|---|
| To: | Alexander Farber <alexander(dot)farber(at)gmail(dot)com> | 
| Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> | 
| Subject: | Re: Appending a newline to a column value - in a psql cronjob | 
| Date: | 2012-01-13 14:02:52 | 
| Message-ID: | 248041B1-81D0-4742-97CD-B05FCE5D51A0@yahoo.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
... || id || E'\n' ...
To enable the backslash escape you prefix the literal with the letter E
David J.
On Jan 13, 2012, at 7:11, Alexander Farber <alexander(dot)farber(at)gmail(dot)com> wrote:
> Hello!
> 
> I'm using PostgreSQL 8.4.9 on CentOS 6.2 and with bash.
> 
> The following cronjob works well for me
> (trying to send a mail to myself - for moderation):
> 
> 6       6       *       *       *       psql -c "select
> 'http://mysite/user.php?id=' ||id, about from pref_rep where
> length(about) > 1 and last_rated > now() - interval '1 day'"
> 
> but I can't figure out how to append a newline to the
> 1st value (because otherwise the line is too long
> and I have to scroll right in my mail reader):
> 
> What I've tried sofar:
> 
> # history
> 1001  psql -c "select 'http://mysite/user.php?id=' ||id||'\n', about from .....
> 1002  psql -c "select 'http://mysite/user.php?id=' ||id||'\\n', about
> from .....
> 1003  psql -c "select 'http://mysite/user.php?id=' ||id|| "\\n",
> about from .....
> 1004  psql -c "select 'http://mysite/user.php?id=' ||id|| \"\\n\",
> about from .....
> 1005  psql -c "select 'http://mysite/user.php?id=' ||id|| \"\n\",
> about from .....
> 1006  psql -c "select 'http://mysite/user.php?id=' ||id|| \'\n\',
> about from .....
> 
> Thank you
> Alex
> 
> -- 
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Hardy, Paul | 2012-01-13 15:07:16 | pg_bulkloader | 
| Previous Message | Rob Sargentg | 2012-01-13 13:55:22 | Re: Appending a newline to a column value - in a psql cronjob |