I have created a script to email some results from a query to meself..
Basically something like this:
(
echo "To: luuk@inalid.lan"
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 luuk@invalid.lan
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: luuk@inalid.lan"
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 luuk@invalid.lan
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: luuk@inalid.lan"
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 luuk@invalid.lan
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: | 113 |
Nodes: | 8 (1 / 7) |
Uptime: | 121:32:32 |
Calls: | 2,501 |
Files: | 8,692 |
Messages: | 1,923,784 |