grep 是「搜尋字串」的意思,作用是在檔案內容裡比對符合條件的字串。
grep [選項] 字串 檔名 ...
1)在 stdout1.log 中找出含 exception 的行。

2)統計 stdout1.log 中含 exception 的行數。

3)找出含 exception 的行,並標出行號。

4)忽略大小寫找出 exception,同時顯示行號。

5)同時在 stdout1.log 與 stdout2.log 中搜尋 exception。

6)只印出比對成功(或失敗)的檔案清單。

7)找出同時含 exception 與 error 的行。

8)找出含 error 的行,並帶出前後各四行上下文。
