Cygwin

zhaozj2021-02-16  185

The purpose of the original installation CGYWIN is to be familiar with the Linux operation command, but when learning the shell programming method, accidentally discovery that it is uses it to handle the extraordinary text file is 'fast and provincial'.

For the simplest example, such as a J2EE App Server log file sys.log, more than 20m, find all the commands with the connection timeout keyword and save to another file new1.txt, is:

> cat sys.log | GREP "Connection Timeout"> New1.txt

Also, the statistics or word statistics are also very convenient. I want to know that the number of rows and times of Exception words in a big file sys.log are:> cat sys.log | grep exception | WC -L

> CAT Sys.log | GREP EXCEPTION | WC -W

The above is just the simplest example, and there are many other commands, such as file mergers or operations for the column. The power of the SHELL is very much. It is worth studying.

?

转载请注明原文地址:https://www.9cbs.com/read-8029.html

New Post(0)