Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The realization method of finding the specified content of large File by linux

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Think big and small, and then redirect.

Linux sometimes encounters a file that is so large that the keyword search exceeds the whole screen and cannot see everything. For example, a very large log file info.log, if we want to view all logs of a certain character, it can be the same as cat info.log | grep '1711178968'. If there are too many logs, you can add time and control the number of lines. You can also use the'> > 'instruction. Cat info.log | grep '1711178968' > > temp.log temporarily save the intermediate result and view the temp.log file page by page through more, less and other tools

If it is a log with a certain time range, you can still intercept the log according to the time:

/ / intercept logs for a certain period of time sed-n'/ 2018-10-25 17 25.log 30 root.2018 41According to Grammer 2018-10-25 21 21 purge 47 purl 47 hand-10-25.log > update.log

Intercept logs between 17: 30 and 21: 47 in log 25.

View through the more instruction.

Then / ${keyword} search, such as / 1711178968, n next, b last

The above linux search for large files to specify the content of the implementation method is the editor to share with you all the content, I hope to give you a reference, but also hope that you support more.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report