OK, I should have explained better. What I was looking for was something I could run from a terminal with cron or something. Here is what I ended up using. Looks like it works right.
[cy@tuxbox cy]$ echo "select id, user from TABLE" | /usr/local/mysql/bin/mysql -uUSERNAME -pPASSWORD DB_NAME > /tmp/file.txt;
Thanks for the reply