EMBED THIS RECORDING:
<div><script id="playterm-MjAxMi0wNi9teXNxbHBhZ2VydHR5cmVjLTEzNDAwMTA5MTl8ODB4MjQ=" type="text/javascript" src="https://playterm.org/js/?hash=MjAxMi0wNi9teXNxbHBhZ2VydHR5cmVjLTEzNDAwMTA5MTl8ODB4MjQ=" class="size:80x24"></script></div>
I recorded this `mysql pagers` shellsession because pagers havent been explained too much in the
mysql docs. Nevertheless, its a great tool to monitor/automate/manage database output using
shellscript.
Snippets
in mysql console
================
mysql> pager more
mysql> (do your select)
mysql> nopager
mycronscript.sh
===============
#!/bin/bash
dosomething(){
cat - | grep Town
}
mysql -u root -pYOURPWD --pager=dosomething -e "SELECT * FROM customer" dbname
Coder of Salvation said
btw. as you can see in the cronscripts: storing passwords in shellscripts is ugly. Anyone got ideas
to improve this?
Matt Herr said
if somebody emails you "give me the last x of this or that", you can just do:
mysql> pager vim -
mysql> (do your select)
Then you can edit the contents, and write it to a file etc. =]