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: | 296 |
Nodes: | 16 (2 / 14) |
Uptime: | 73:52:12 |
Calls: | 6,657 |
Calls today: | 3 |
Files: | 12,203 |
Messages: | 5,332,496 |
Posted today: | 1 |