I have created a script to email some results from a query to meself..
Basically something like this:
(
echo "To: [email protected]"
echo "Subject: TEST"
echo "Content-Type: text/html; charset=us-ascii"
echo
echo "<html>"
psql -H -f test.sql postgresql://user:passwd@here@test
echo "</html>"
) | /usr/sbin/sendmail -f [email protected]
This works OK, but at the end of the email i always see a line like:
(10 rows)
Is it possible to remove this line with the help of postgresql?
I know there are ways to do it with 'sed', but .... ;)
I have created a script to email some results from a query to meself..
Basically something like this:
(
echo "To: [email protected]"
echo "Subject: TEST"
echo "Content-Type: text/html; charset=us-ascii"
echo
echo "<html>"
psql -H -f test.sql postgresql://user:passwd@here@test
echo "</html>"
) | /usr/sbin/sendmail -f [email protected]
This works OK, but at the end of the email i always see a line like:
(10 rows)
Is it possible to remove this line with the help of postgresql?
On 13/05/17 02:07 PM, Luuk wrote:
I have created a script to email some results from a query to meself..
Basically something like this:
(
echo "To: [email protected]"
echo "Subject: TEST"
echo "Content-Type: text/html; charset=us-ascii"
echo
echo "<html>"
psql -H -f test.sql postgresql://user:passwd@here@test
echo "</html>"
) | /usr/sbin/sendmail -f [email protected]
This works OK, but at the end of the email i always see a line like:
(10 rows)
Is it possible to remove this line with the help of postgresql?
Yes. In psql the \pset meta-command can do all sorts of things. In
your specific case, adding '\pset footer off' to the SQL before any
queries will omit the undesired line.
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 715 |
| Nodes: | 16 (2 / 14) |
| Uptime: | 159:58:35 |
| Calls: | 12,094 |
| Calls today: | 2 |
| Files: | 15,000 |
| Messages: | 6,517,761 |