我正在嘗試在我的日誌文件中找到偶數。總結grep -c
命令:
grep -Eo "2016-08-30" applciationLog.log* -c
輸出:
applciationLog.log.1:0
applciationLog.log.2:0
applciationLog.log.3:0
applciationLog.log.4:0
applciationLog.log.5:7684
applciationLog.log.6:9142
applciationLog.log.7:8699
applciationLog.log.8:0
所有這些值7684 + 9142 + 8699 = 25525.任何建議我可以做什麼,我其實需要的是總和?任何我可以附加到grep來啓用它。
任何幫助或指針,歡迎和讚賞。
的grep的工作就是找東西。增加數字不是它的工作。您將grep的輸出提供給awk/sed並在那裏進行添加。 –