Dan*_*Dan 42 linux logfiles filter
我需要阅读Linux系统上的一些巨大的日志文件.日志中有很多混乱.目前我正在做这样的事情:
cat logfile.txt | grep -v "IgnoreThis\|IgnoreThat" | less
Run Code Online (Sandbox Code Playgroud)
但它很麻烦 - 每次我想添加另一个过滤器时,我都需要退出less并编辑命令行.一些滤波器相对复杂并且可以是多线的.
我想通过日志阅读一些方法来应用过滤器,以及在某处保存这些过滤器的方法.
有没有可以为我做这个的工具?我无法安装新软件,所以希望它已经安装好了 - 例如,less,vi,Python或Perl lib等等.
更改生成日志以生成更少的代码不是一种选择.
小智 105
&pattern在less内使用命令.
从手册页中减去
&图案
Run Code Online (Sandbox Code Playgroud)Display only lines which match the pattern; lines which do not match the pattern are not displayed. If pattern is empty (if you type & immediately followed by ENTER), any filtering is turned off, and all lines are displayed. While filtering is in effect, an ampersand is displayed at the beginning of the prompt, as a reminder that some lines in the file may be hidden. Certain characters are special as in the / command: ^N or ! Display only lines which do NOT match the pattern. ^R Don't interpret regular expression metacharacters; that is, do a simple textual comparison.
| 归档时间: |
|
| 查看次数: |
29617 次 |
| 最近记录: |