請教用awk分析squid log檔的問題 - Linux
By Bennie
at 2013-04-30T15:13
at 2013-04-30T15:13
Table of Contents
※ 引述《filiaslayers (司馬雲)》之銘言:
: 不知道這邊有人熟awk語法嗎?
: 請教我想要分析squid3的log檔
: 我要分析這份log檔有些ip,該如何寫?
: awk好像不能使用矩陣,我本來想說把得到的ip存入矩陣,再一次輸出
ex:
#tail /var/log/squid/access.log
30/Apr/2013:04:32:32 +0800 0 95.154.228.165 - GET
"http://37.28.156.211/sprawdza.php"+"/sprawdza.php" of "-" HTTP/1.1-407
TCP_DENIED 3838bytes NONE[-] text/html
只想顯示IP
awk '{print $4}' /var/log/squid/access.log
如果你要存入陣列的話,寫script
#!/bin/bash
array=`awk '{print $1}' /var/log/squid/access.log`
for (( i=0; i<=2; i++ )) do
echo ${array[$i]}
done
--
: 不知道這邊有人熟awk語法嗎?
: 請教我想要分析squid3的log檔
: 我要分析這份log檔有些ip,該如何寫?
: awk好像不能使用矩陣,我本來想說把得到的ip存入矩陣,再一次輸出
ex:
#tail /var/log/squid/access.log
30/Apr/2013:04:32:32 +0800 0 95.154.228.165 - GET
"http://37.28.156.211/sprawdza.php"+"/sprawdza.php" of "-" HTTP/1.1-407
TCP_DENIED 3838bytes NONE[-] text/html
只想顯示IP
awk '{print $4}' /var/log/squid/access.log
如果你要存入陣列的話,寫script
#!/bin/bash
array=`awk '{print $1}' /var/log/squid/access.log`
for (( i=0; i<=2; i++ )) do
echo ${array[$i]}
done
--
Tags:
Linux
All Comments
Related Posts
virsh+rc.local
By Liam
at 2013-04-30T13:56
at 2013-04-30T13:56
沒接螢幕開機,再接螢幕無訊號
By Iris
at 2013-04-30T13:27
at 2013-04-30T13:27
emacs 中輸入中文
By David
at 2013-04-30T12:47
at 2013-04-30T12:47
請教用awk分析squid log檔的問題
By Steve
at 2013-04-30T12:08
at 2013-04-30T12:08
Shell Script 大量同時安裝 rpm 的方法?
By Kama
at 2013-04-30T11:53
at 2013-04-30T11:53