在linux命令行上按时间戳排序日志文件
发布时间:2021-03-30 18:33:07 所属栏目:Linux 来源:互联网
导读:我有一个日志文件,条目如下: ... freeswitch.log:2011-09-08 12:21:07.282236 [ERR] ftdm_queue.c:136 Failed to enqueue obj 0x7f2cda3525c0 in queue 0x7f2ce8005990, no more room! windex == rindex == 58!freeswitch.l
我有一个日志文件,条目如下: ... freeswitch.log:2011-09-08 12:21:07.282236 [ERR] ftdm_queue.c:136 Failed to enqueue obj 0x7f2cda3525c0 in queue 0x7f2ce8005990,no more room! windex == rindex == 58! freeswitch.log:2011-08-08 13:21:07.514261 [ERR] ftdm_queue.c:136 Failed to enqueue obj 0x7f2cda354460 in queue 0x7f2ce8005990,no more room! windex == rindex == 58! freeswitch.log:2011-06-04 16:21:08.998227 [ERR] ftdm_queue.c:136 Failed to enqueue obj 0x7f2cda356300 in queue 0x7f2ce8005990,no more room! windex == rindex == 58! freeswitch.log:2011-09-08 12:21:10.374238 [ERR] ftdm_queue.c:136 Failed to enqueue obj 0x7f2cda3581a0 in queue 0x7f2ce8005990,no more room! windex == rindex == 58! ... 如何使用linux命令行工具对每个行中的时间戳进行排序? 解决方法使用 sort的-k标志:sort -k1 -r freeswitch.log 这将按照第一个键(即freeswitch.log:2011-09-08 12:21:07.282236)对文件进行排序.如果文件名总是相同的(freeswitch.log),那么它应该按日期排序. (编辑:4S站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- linux – /usr/bin/env关于shebang line pecularities的问题
- linux – xprop设置atom属性的多个字段
- linux – ssh multi-hop上的“bash:nc:command not found
- 停止或重新加载后,Vagrant错误“无法挂载Linux客户机中的文
- linux – find命令只搜索非隐藏目录
- “初始化器元素不是常量”错误,在Linux GCC中没有任何原因,
- LINUX实操:Shell输入/输出重定向
- linuxmint – Linux Mint 17.1 Cinnamon 2.4鼠标光标在屏幕
- LINUX实战:Linux基础知识:网络属性配置
- linux – 为目录中的每个文件运行shell脚本