主要是分析lag
它的格式範例大致如下:
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
5FE7D17E9DC 57621 Mon Mar 28 10:24:56 [email protected]
(connect to aaa.ttt.org[xxx.xxx.xxx.xxx]: Connection refused)
[email protected]
現在要配合分析的程式把第三行的[email protected]
改成 remote [email protected]
remove和[email protected]中間只有要空白隔開即可多少不個空白不重要
試著利用grep和sed是能夠抓到我要的東西並修改
一開始我的寫法是
cat maillist | grep -v '^$' | grep -v '^[0-9A-Z]' | grep -v '(' | grep -v '^-'
| sed 's/^/remote/g'
但這樣寫是把我要的改的東西抓出來改好後輸出
和原本的需求不同
如果要直接寫進log不影響原本的格式
也就是log內容會是
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
5FE7D17E9DC 57621 Mon Mar 28 10:24:56 [email protected]
(connect to aaa.ttt.org[xxx.xxx.xxx.xxx]: Connection refused)
remote [email protected]
直接改掉應該要怎麼寫才好呢?
--
它的格式範例大致如下:
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
5FE7D17E9DC 57621 Mon Mar 28 10:24:56 [email protected]
(connect to aaa.ttt.org[xxx.xxx.xxx.xxx]: Connection refused)
[email protected]
現在要配合分析的程式把第三行的[email protected]
改成 remote [email protected]
remove和[email protected]中間只有要空白隔開即可多少不個空白不重要
試著利用grep和sed是能夠抓到我要的東西並修改
一開始我的寫法是
cat maillist | grep -v '^$' | grep -v '^[0-9A-Z]' | grep -v '(' | grep -v '^-'
| sed 's/^/remote/g'
但這樣寫是把我要的改的東西抓出來改好後輸出
和原本的需求不同
如果要直接寫進log不影響原本的格式
也就是log內容會是
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
5FE7D17E9DC 57621 Mon Mar 28 10:24:56 [email protected]
(connect to aaa.ttt.org[xxx.xxx.xxx.xxx]: Connection refused)
remote [email protected]
直接改掉應該要怎麼寫才好呢?
--
All Comments