[Database] How to Use grep and MySQL grep in the database

Source: Internet
Author: User

We often use grep operations like Linux in database operations. The following solutions are available:

1. Run the MySQL operation in Linux and perform grep on it. However, this method cannot be used in MySQL.

$ Mysql-u me-P "use sometable; Describe tables;" | grep "user"

2. Use pager for filtering. pager is powerful and truly implements the grep function;

Mysql> pager grep userpager set to 'grep user' mysql> Use sometable; mysql> describe tables;

3. Simple Method, pager modification is a little more troublesome, but the following method is relatively simple to use, but it seems only applicable to commands starting with show, DESC and other commands cannot be used

Mysql> show tables like '% users % ';

In general, there are several such cases. Of course, some people directly use shell scripts. Hey hey, let's study it by yourself. We recommend you study pager, which is very useful.

OriginalArticlePlease specify the source for loading:Http://blog.csdn.net/handsomerocco/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.