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

  免費注冊 查看新帖 |

Chinaunix

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

[文本處理] 如何通過指定時間,截取log指定行 [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2014-10-30 11:15 |只看該作者 |倒序瀏覽
如何通過指定時間,截取log指定行


求教各位大蝦,如何通過指定時間,截取log指定行,

2014/10/11 22222
2014/10/13 aaaaaaaaa
2014/10/14 33
2014/10/26 111111
2014/10/29 aaaaa
2014/10/29 dddddddddd
2014/10/29 ccccccc

比如 我需要10/26 - 10/29 的log
那么結(jié)果是
2014/10/26 111111
2014/10/29 aaaaa
2014/10/29 dddddddddd
2014/10/29 ccccccc

論壇徽章:
145
技術(shù)圖書徽章
日期:2013-10-01 15:32:13戌狗
日期:2013-10-25 13:31:35金牛座
日期:2013-11-04 16:22:07子鼠
日期:2013-11-18 18:48:57白羊座
日期:2013-11-29 10:09:11獅子座
日期:2013-12-12 09:57:42白羊座
日期:2013-12-24 16:24:46辰龍
日期:2014-01-08 15:26:12技術(shù)圖書徽章
日期:2014-01-17 13:24:40巳蛇
日期:2014-02-18 14:32:59未羊
日期:2014-02-20 14:12:13白羊座
日期:2014-02-26 12:06:59
2 [報告]
發(fā)表于 2014-10-30 11:20 |只看該作者
回復(fù) 1# shintoky

$ awk -vs="2014/10/26" -ve="2014/10/29" '$1>=s&&$1<=e' FILE
2014/10/26 111111
2014/10/29 aaaaa
2014/10/29 dddddddddd
2014/10/29 ccccccc

論壇徽章:
4
獅子座
日期:2014-04-17 10:45:47雙魚座
日期:2014-08-21 17:16:41處女座
日期:2014-08-26 13:46:46水瓶座
日期:2014-10-28 14:08:50
3 [報告]
發(fā)表于 2014-10-30 11:38 |只看該作者

root@ubuntu:l# cat i
2014/10/11 22222
2014/10/13 aaaaaaaaa
2014/10/14 33
2014/10/26 111111
2014/10/29 aaaaa
2014/10/29 dddddddddd
2014/10/29 ccccccc
  1. root@ubuntu:# awk -F '[/ ]' '{T=$1$2$3;if(T>=20141026)print $0}' i
  2. 2014/10/26 111111
  3. 2014/10/29 aaaaa
  4. 2014/10/29 dddddddddd
  5. 2014/10/29 ccccccc
復(fù)制代碼

論壇徽章:
0
4 [報告]
發(fā)表于 2014-10-30 11:42 |只看該作者
回復(fù) 2# jason680


    謝謝 不過不知道為什么 打印出來的是空白 可能因為我時間戳 后面內(nèi)容比較多?

論壇徽章:
0
5 [報告]
發(fā)表于 2014-10-30 11:45 |只看該作者
回復(fù) 3# 圣西羅門柱

thanks but ..

root@1111:~ # awk -F '[/ ]' '{T=$1$2$3;if(T>=20141026)print $0}' file
awk: syntax error near line 1
awk: bailing out near line 1

論壇徽章:
0
6 [報告]
發(fā)表于 2014-10-30 11:53 |只看該作者
回復(fù) 1# shintoky

log實際內(nèi)容會更多

2014/10/26 19:47:27 ERROR V-16-2-13077 Agent is unable to  Administrative intervention may be required.
2014/10/29 19:48:28 ERROR V-16-2-13077 Agent is unable to  Administrative intervention may be required.
2014/10/29 19:49:29 ERROR V-16-2-13077 (server) Agent is unable to  Administrative intervention may be required.

論壇徽章:
33
ChinaUnix元老
日期:2015-02-02 08:55:39CU十四周年紀(jì)念徽章
日期:2019-08-20 08:30:3720周年集字徽章-周	
日期:2020-10-28 14:13:3020周年集字徽章-20	
日期:2020-10-28 14:04:3019周年集字徽章-CU
日期:2019-09-08 23:26:2519周年集字徽章-19
日期:2019-08-27 13:31:262016科比退役紀(jì)念章
日期:2022-04-24 14:33:24
7 [報告]
發(fā)表于 2014-10-30 13:00 |只看該作者
回復(fù) 5# shintoky


    什么操作系統(tǒng)?

論壇徽章:
0
8 [報告]
發(fā)表于 2014-10-30 14:38 |只看該作者
[try@KeepTry patrol]$ cat keeptest
2014/10/26 19:47:27 ERROR V-16-2-13077 Agent is unable to  Administrative intervention may be required.
2014/10/28 19:48:28 ERROR V-16-2-13077 Agent is unable to  Administrative intervention may be required.
2014/10/29 19:48:28 ERROR V-16-2-13077 Agent is unable to  Administrative intervention may be required.
2014/10/29 19:49:29 ERROR V-16-2-13077 (server) Agent is unable to  Administrative intervention may be required.
[try@KeepTry patrol]$ grep "10/2[6-8]" keeptest
2014/10/26 19:47:27 ERROR V-16-2-13077 Agent is unable to  Administrative intervention may be required.
2014/10/28 19:48:28 ERROR V-16-2-13077 Agent is unable to  Administrative intervention may be required.
回復(fù) 1# shintoky


   

論壇徽章:
0
9 [報告]
發(fā)表于 2014-10-30 15:14 |只看該作者
回復(fù) 7# Shell_HAT


    Solaris 10

論壇徽章:
0
10 [報告]
發(fā)表于 2014-10-30 15:16 |只看該作者
回復(fù) 8# tasteoftime_90


    哈哈 這個可以 不過最好通過定義 字段1的時間來截取
grep 高手啊
您需要登錄后才可以回帖 登錄 | 注冊

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

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP