檢視大檔案中的錯誤日誌
利用less或more命令定位到錯誤日誌的行數,然後用sed檢視指定行的錯誤日誌
1)查詢檔案中含有"error"的行
<方法1>less -iN irecon-daemon.log 然後輸入 /error 進行搜尋,可看到所在的行數
<方法2>more +/error irecon-daemon.log 然後輸入 = 會顯示當前所在的行數
2)從100行到200行的日誌過濾含有"error"的行
sed -n '100,200p' irecon-daemon.log |grep -ni "eRROR" --color
有時候,也可以用head和tail命令達到檢視日誌的功能