[問題] grep 擷取內容
grep "要搜尋的關鍵字" 檔案名稱
依照上面的例子,就可以將檔案內容符合關鍵字的行數,擷取出來
但是今天我想要多擷取關鍵字加上關鍵字的下一行
比如說:
test.txt內容如下:
receive Hello
Welcome to DSGH
Please tell me your ID
我下grep "Hello" test.txt
會秀出 receive Hello
但是有什麼方法可以
receive Hello
Welcome to DSGH
秀出關鍵字外的那一行加上下一行
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.117.89.82
※ 文章網址: https://www.ptt.cc/bbs/Linux/M.1468204335.A.115.html
→
07/11 10:44, , 1F
07/11 10:44, 1F
→
07/11 23:46, , 2F
07/11 23:46, 2F
→
07/11 23:46, , 3F
07/11 23:46, 3F
Linux 近期熱門文章
21
56
PTT數位生活區 即時熱門文章