我有一个这样的日志文件。我不希望获取先前在诸如09:28如何根据时间间隔获取这些错误/不匹配字符串
Connected to feeder version 2.1 09:28:30 29/03/2014 Loading AccountEUR
09:28:30 29/03/2014 Loading AccountJPY
09:28:30 29/03/2014 Loading AccountINR
09:28:30 29/03/2014 Loading AccountUSD
09:28:30 29/03/2014 Loading AccountEUR
09:28:30 29/03/2014 Account 0234456783388KRY not set up
09:28:30 29/03/2014 Account 0234454467888CNH not set up
09:28:30 29/03/2014 Error : Closing Balance of Account 02344567888GBP Doesn't match
Connected to feeder version 2.1 09:28:30 29/03/2014 Loading AccountEUR
10:28:30 29/03/2014 Loading AccountGBP
10:28:30 29/03/2014 Loading AccountINR
10:28:30 29/03/2014 Loading AccountUSD
10:28:30 29/03/2014 Loading AccountEUR
10:28:30 29/03/2014 Account 02344567833886KRY not set up
10:28:30 29/03/2014 Account 023445446788866CNH not set up
10:28:30 29/03/2014 Error : Closing Balance of Account 02344567888GBP Doesn't match
现在我用下面的sed命令来获取错误占
sed -n "
s/.* Closing Balance of Account \(.*\) Doesn't match/\1/p;
s/.* Account \(.*\) not set up/\1/p
"
获取的账户,但如何只提取新帐户。例如,我不希望9.28的账户再次以10.28的价格出现。在此先感谢您的帮助
您可以发布预期的输出吗? – Jotne
你怎么知道09:28线是“先前提取的”?日志文件中是否有标记? –
嗨,基本上我正在写一个监控脚本,每10分钟检查一次这个日志文件,如果有任何错误,那么它会发送这些错误帐户列表。所以1小时后,如果我收到几个错误/不匹配的帐户,我只需要在我的列表中的新帐户。 – user2647888