当前位置: 技术问答>linux和unix
关于特殊log格式的过滤问题,各位请帮忙看看
来源: 互联网 发布时间:2016-09-20
本文导语: log 格式如下: --------------------------------- Sat Aug 7 02:53:32 2010 Stopping background process CJQ0 Sat Aug 7 02:53:32 2010 Stopping background process MMNL Sat Aug 7 02:53:33 2010 Stopping background process MMON Sat Aug 8 02:53:32 2010 St...
log 格式如下:
---------------------------------
Sat Aug 7 02:53:32 2010
Stopping background process CJQ0
Sat Aug 7 02:53:32 2010
Stopping background process MMNL
Sat Aug 7 02:53:33 2010
Stopping background process MMON
Sat Aug 8 02:53:32 2010
Stopping background process CJQ0
Sat Aug 8 02:53:32 2010
Stopping background process MMNL
Sat Aug 8 02:53:33 2010
Stopping background process MMON
----------------------------------
我现在需要取 8 号的 Stopping background process MMON 这行,如何处理?
---------------------------------
Sat Aug 7 02:53:32 2010
Stopping background process CJQ0
Sat Aug 7 02:53:32 2010
Stopping background process MMNL
Sat Aug 7 02:53:33 2010
Stopping background process MMON
Sat Aug 8 02:53:32 2010
Stopping background process CJQ0
Sat Aug 8 02:53:32 2010
Stopping background process MMNL
Sat Aug 8 02:53:33 2010
Stopping background process MMON
----------------------------------
我现在需要取 8 号的 Stopping background process MMON 这行,如何处理?
|
cat urfile | awk '/Aug 8/{getline;print}' | awk 'END{print}'