linux - The online log file is very large, 200M. If you use VI to view it, it will freeze. How to search the content?
滿天的星座
滿天的星座 2017-06-14 10:50:22
0
4
1156

The online log file is very large, 200M. If you use VI to view it, it will freeze. How to search the content?

滿天的星座
滿天的星座

reply all(4)
typecho

You can use grep to search, supports regular expressions

Or you can use head tail etc. to view the content of the head and tail

Or use sed to view the content within the specified range. sed also supports string ranges, such as sed -nre '/regex1/,/regex2/p' log can print the log between the two matching regular expressions

In addition, awk can display specified columns

If there is really no available tool, you can use perl one-liner or script instead. Although this language is old, regular expressions are very powerful and worth learning

黄舟

Use the less command.
less file.

过去多啦不再A梦

To search, generally use cat file_name | grep search_string

迷茫

Why not just grep?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template