Use the awk tool in cygwin to view mysql binlog logs
Linux tools are really powerful. However, as a person who does not have the right to use linux machines or who does not use linux for development, it is really inconvenient to use some commands, a unix-like simulation environment running on windows platform is a free software developed by cygnus solutions, which brings a lot of convenience to the use of some commands. The first requirement is: binlog logs exported by others, 100 + Mb. It is very slow to open using a windows text editor, and it is almost too slow to be viewed, so I want to select the relevant lines and save them as another small file for easy viewing! 1. The installation of cygwinis detailed. The installation procedure is as follows: run the Installation File setup.exe again. 2. for initial debugging, run the first command: The ls command. Check the current directory file and find that there are no files (check cd/and ls, which is similar to linux ); the second command: view the current directory pwd and find/home/myhome; (in windows, you can easily add environment variables, and then quickly open cygwin: Run> minitty, then list the current directory: pwd and find it is the third command:/cygdrive/c/Users/myhome. If you know the directory structure, you only need to find the file you want to open, see the following: more/cygdrive/c/Users/Desktop/binlog.20.33, and then the full screen is completely invisible. Fourth command: since linux is used, awk must be used as a powerful text processing tool, as shown below: more/cygdrive/c/Users/Desktop/binlog.20.33 | awk-F' @ ''/tab_user [^ _]/{print NR," ==> ", $0} '> filtered-binlog.txt; in this case, the internal volume output to filtered-binlog.txt, it looks much easier. Use other useful commands. Note that the characters in the awk must use double quotation marks, which can be escaped, for example :\". 3. Click setup.exe to install the tool. (No apt-get, no yum, be sure not to conflict with windows) So, you can use a variety of commands, although apt-get, su, yum and other commands are not available, however, other operations can be used ~