亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 2077 | 回復(fù): 3
打印 上一主題 下一主題

SHELL提取日志的問題 [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2008-09-08 17:44 |只看該作者 |倒序?yàn)g覽
大家好:
      我先給大家看段日志內(nèi)容:
[root@localhost boot]# tail -n 20 /var/log/messages
Sep  3 19:52:06 localhost last message repeated 4 times
Sep  3 19:55:39 localhost last message repeated 4 times
Sep  3 19:57:06 localhost squid: Could not determine fully qualified hostname.  Please set 'visible_hostname'
Sep  3 19:57:50 localhost squid: Could not determine fully qualified hostname.  Please set 'visible_hostname'
Sep  3 19:59:53 localhost squid[30131]: Squid Parent: child process 30133 started
Sep  3 19:59:53 localhost (squid): ipcache_init: DNS name lookup tests failed.
Sep  3 19:59:53 localhost squid[30131]: Squid Parent: child process 30133 exited due to signal 6
Sep  3 19:59:56 localhost squid[30131]: Squid Parent: child process 30135 started
Sep  3 19:59:56 localhost (squid): ipcache_init: DNS name lookup tests failed.
Sep  3 19:59:56 localhost squid[30131]: Squid Parent: child process 30135 exited due to signal 6
Sep  3 19:59:59 localhost squid[30131]: Squid Parent: child process 30137 started
Sep  3 19:59:59 localhost (squid): ipcache_init: DNS name lookup tests failed.
Sep  3 19:59:59 localhost squid[30131]: Squid Parent: child process 30137 exited due to signal 6
Sep  3 20:00:02 localhost squid[30131]: Squid Parent: child process 30158 started
Sep  3 20:00:03 localhost (squid): ipcache_init: DNS name lookup tests failed.
Sep  3 20:00:03 localhost squid[30131]: Squid Parent: child process 30158 exited due to signal 6
Sep  3 20:00:04 localhost squid[30160]: Squid Parent: child process 30162 started
Sep  3 20:00:06 localhost squid[30131]: Squid Parent: child process 30166 started
Sep  3 20:00:06 localhost squid[30131]: Squid Parent: child process 30166 exited with status 1
Sep  3 20:00:06 localhost squid[30131]: Exiting due to repeated, frequent failures
       我想用SHELL實(shí)現(xiàn)的功能是:用SHELL提取固定時間內(nèi)的的日志記錄行,并進(jìn)行輸出,最好用AWK實(shí)現(xiàn).例如:我想提取19:55:39至20:00:02這段時間的日志,那么腳本的輸出就應(yīng)該是:
Sep  3 19:55:39 localhost last message repeated 4 times
Sep  3 19:57:06 localhost squid: Could not determine fully qualified hostname.  Please set 'visible_hostname'
Sep  3 19:57:50 localhost squid: Could not determine fully qualified hostname.  Please set 'visible_hostname'
Sep  3 19:59:53 localhost squid[30131]: Squid Parent: child process 30133 started
Sep  3 19:59:53 localhost (squid): ipcache_init: DNS name lookup tests failed.
Sep  3 19:59:53 localhost squid[30131]: Squid Parent: child process 30133 exited due to signal 6
Sep  3 19:59:56 localhost squid[30131]: Squid Parent: child process 30135 started
Sep  3 19:59:56 localhost (squid): ipcache_init: DNS name lookup tests failed.
Sep  3 19:59:56 localhost squid[30131]: Squid Parent: child process 30135 exited due to signal 6
Sep  3 19:59:59 localhost squid[30131]: Squid Parent: child process 30137 started
Sep  3 19:59:59 localhost (squid): ipcache_init: DNS name lookup tests failed.
Sep  3 19:59:59 localhost squid[30131]: Squid Parent: child process 30137 exited due to signal 6
Sep  3 20:00:02 localhost squid[30131]: Squid Parent: child process 30158 started
       望高手捧場!謝謝!!!

論壇徽章:
23
15-16賽季CBA聯(lián)賽之吉林
日期:2017-12-21 16:39:27白羊座
日期:2014-10-27 11:14:37申猴
日期:2014-10-23 08:36:23金牛座
日期:2014-09-30 08:26:49午馬
日期:2014-09-29 09:40:16射手座
日期:2014-11-25 08:56:112015年辭舊歲徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:49:0315-16賽季CBA聯(lián)賽之山東
日期:2017-12-21 16:39:1915-16賽季CBA聯(lián)賽之廣東
日期:2016-01-19 13:33:372015亞冠之山東魯能
日期:2015-10-13 09:39:062015亞冠之西悉尼流浪者
日期:2015-09-21 08:27:57
2 [報(bào)告]
發(fā)表于 2008-09-08 17:51 |只看該作者
awk '$1=="Sep" && $2 ==3 && $3>="19:55:39" && $3<="20:00:02"' /var/log/messages

論壇徽章:
0
3 [報(bào)告]
發(fā)表于 2008-09-08 17:59 |只看該作者
NB,哈哈
謝謝大哥了!!

論壇徽章:
3
CU大牛徽章
日期:2013-03-13 15:29:07CU大;照
日期:2013-03-13 15:29:49CU大;照
日期:2013-03-13 15:30:19
4 [報(bào)告]
發(fā)表于 2008-09-08 18:45 |只看該作者
awk真不錯。開始學(xué)awk
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP