作者seedbcc.bbs@ptt.cc (志明) 看板: linux
標題Re: [問題] egrep+awk後,如何在每一列自行加 西元 …
時間批踢踢實業 (2008/05/11 Sun 21:46:04)
感謝你的幫忙
不過我使用你的二個方式,依舊有些許問題
第一種的結果: 會出現 三列要分析的原始資料
<<< LOGON Fail REPORT>>>
May 09 09:31:57 AAA sshd[xxx]: error: PAM: failure for test3 from 192.168.5.5
09:31:57 09 May 2008, test3
May 09 09:31:58 AAA sshd[xxx]: error: PAM: failure for test3 from 192.168.5.5
09:31:58 09 May 2008, test3
May 09 09:31:59 AAA sshd[xxx]: error: PAM: failure for test3 from 192.168.5.5
09:31:59 09 May 2008, test5
<<<End of Logon Fail Report>>>
第二種的結果= 會出現 一列要分析的原始資料
<<< LOGON Fail REPORT>>>
May 09 09:31:57 AAA sshd[xxx]: error: PAM: failure for test3 from 192.168.5.5
09:31:57 09 May 2008, test3
09:31:58 09 May 2008, test3
09:31:59 09 May 2008, test5
<<<End of Logon Fail Report>>>
實在想不出 我仍然需要修改哪些script...
※ 引述《MOONRAKER (㊣烏笨禿,又笨又禿)》之銘言:
: : 推 seedbcc:我也知 加2008,問題是..若到2009 我不就要自行再改一次..
: 那也很簡單
: '{YR=strftime("%Y"); printf("%s %s %s %s, %s\n", $3, $2, $1, YR, $11)}'
: 不然
: '{"date +%Y" | getline YR; \
: printf("%s %s %s %s, %s\n", $3, $2, $1, YR, $11)}'
: awk的書線上很多,自己學一學,很實用。
: http://www.math.utah.edu/docs/info/gawk_toc.html
:
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 210.192.233.192