Think big and small, then redirect. Sometimes Linux encounters very large files, and keyword searches must exceed the entire screen, making it impossible to view all the content. For example, if we want to view all logs of a certain string in a very large log file info.log, we can use cat info.log | grep '1711178968'. If too much is displayed, we can add time and line control. You can also use the '>>' command. cat info.log | grep '1711178968' >> temp.log Temporarily save the intermediate results and view the temp.log file page by page using tools such as more and less If the log is within a certain time range, you can still intercept the log based on time: // Capture the logs for a certain period of time sed -n '/2018-10-25 17:30:41/,/2018-10-25 21:47:02/p' root.2018-10-25.log > update.log In the log on the 25th, extract the logs between 17:30 and 21:47. Use the more command to view. Then search with /${keyword}, for example /1711178968, n for the next item, b for the previous item The above method of implementing how to search for specified content in large files in Linux is all I have to share with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. You may also be interested in:
|
<<: The correct way to use MySQL indexes and detailed explanation of index principles
>>: How to Develop a Progressive Web App (PWA)
1. The significance of building nexus service As ...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML ...
There are many differences between IE6 and IE7 in ...
【Foreword】 If you want to use ORM to operate data...
First of all, let me talk to you about my daily l...
There are some differences between filter and bac...
The operating environment of this tutorial: Windo...
top command is the best command that everyone is ...
Since my local MySQL version is relatively low, I...
The most common, most commonly used and most gener...
Abstract: This article mainly explains how to ins...
[ Linux installation of Tomcat8 ] Uninstall Tomca...
Table of contents 1. Quick understanding of conce...
There are two ways to delete data in MySQL: Trunc...
I installed a virtual machine a long time ago, an...