Is there any way to grep the output of the MySQL interpretter (CentOS 5.x)? For instance, I know that I need a table with "user" in the table name. Ideally, I would love something like this:
DESCRIBE TABLES; | grep "user"
I know that I can exit MySQL and then do it in bash:
mysql -u me -p "USE someTable; DESCRIBE TABLES;" | grep "user"
But I would prefer to stay in MySQL. Thanks.
mysql is a simple SQL shell with input line editing capabilities. It supports interactive and noninteractive use. When used interactively, query results are presented in an ASCII-table format. When used noninteractively (for example, as a filter), the result is presented in tab-separated format.
The Windows installer creates an item in the MySQL menu named MySQL command line client - Unicode . This item invokes the mysql client with properties set to communicate through the console to the MySQL server using Unicode.
Give this a try!
mysql> pager grep user
PAGER set to 'grep user'
mysql> USE someTable;
mysql> DESCRIBE TABLES;
I've just tried it with Mysql v5.0.83, and it does what you would think ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With