Reputation: 24705
I use a query command from bash which returns a number. However, it is printed as a table.
$ mysql -u muser -p$PASS mm -e "SELECT.....;"
mysql: [Warning] Using a password on the command line interface can be insecure.
+----------------------------+
| COUNT(DISTINCT ula.userid) |
+----------------------------+
| 29 |
+----------------------------+
I just want to get 29 and append that to a file with >> file.txt
. How can I do that in mysql?
Upvotes: 1
Views: 171
Reputation: 51868
Use skip-column-names
and batch-mode
with -N
and -B
respectively:
mysql -u muser -p$PASS mm -NBe "SELECT.....;" >> file.txt
Upvotes: 2