利用shell抓出mail log 的 said: 550

正好需要分析一下mail 的log檔,要抓取出550類的狀態mail出來,所以直接利用shell script來做,可以很快的分析log並抓取mail狀態為550出來。

1
2
3
4
#!/bin/bash
file="/var/log/mail"
tmp="./edm_tmp.txt"
cat $file | grep 'said: 550' | awk '{print $7}' | sed 's/to=,//gp' | uniq > $tmp

參考資料

Shell 設計入門

Related Posts with Thumbnails

相關文章

發表迴響

您的電子郵件位址並不會被公開。 必要欄位標記為 *

*

您可以使用這些 HTML 標籤與屬性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>