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)
0. New operation: mkdir abc #Create a new folder ...
【content】: 1. Use background-image gradient style...
The arrangement layout of aligning the two ends o...
Effect: CSS style: <style type="text/css&...
Table of contents 01 Create invisible columns 02 ...
Some time ago, I submitted a product version to t...
doctype is one of them: <!DOCTYPE HTML PUBLIC &...
1. Install shadowsocks sudo apt-get install pytho...
Use Javascript to implement a drop-down menu for ...
Two small problems, but they bothered me for a lon...
1. Download MySQL Community Server 5.6.35 Downloa...
Table of contents 1. What is JavaScript? 2. What ...
Below, we introduce three ways to draw heart shap...
<!DOCTYPE HEML PUBLIC> <html> <hea...
In HTML and CSS, we want to set the color of a bu...