grep 擷取內容 - Linux

By Adele
at 2016-07-11T10:32
at 2016-07-11T10:32
Table of Contents
grep "要搜尋的關鍵字" 檔案名稱
依照上面的例子,就可以將檔案內容符合關鍵字的行數,擷取出來
但是今天我想要多擷取關鍵字加上關鍵字的下一行
比如說:
test.txt內容如下:
receive Hello
Welcome to DSGH
Please tell me your ID
我下grep "Hello" test.txt
會秀出 receive Hello
但是有什麼方法可以
receive Hello
Welcome to DSGH
秀出關鍵字外的那一行加上下一行
謝謝
--
依照上面的例子,就可以將檔案內容符合關鍵字的行數,擷取出來
但是今天我想要多擷取關鍵字加上關鍵字的下一行
比如說:
test.txt內容如下:
receive Hello
Welcome to DSGH
Please tell me your ID
我下grep "Hello" test.txt
會秀出 receive Hello
但是有什麼方法可以
receive Hello
Welcome to DSGH
秀出關鍵字外的那一行加上下一行
謝謝
--
Tags:
Linux
All Comments

By Kelly
at 2016-07-12T20:57
at 2016-07-12T20:57

By Carolina Franco
at 2016-07-15T09:50
at 2016-07-15T09:50
Related Posts
讓每個檔案的修改直接差一秒

By Brianna
at 2016-07-10T10:45
at 2016-07-10T10:45
systemd

By Andrew
at 2016-07-09T23:47
at 2016-07-09T23:47
Windows CentOS 雙系統怎麼裝?

By Rebecca
at 2016-07-09T20:08
at 2016-07-09T20:08
systemd

By Aaliyah
at 2016-07-09T19:59
at 2016-07-09T19:59
posfix header_checks 的規則寫法請教

By Kumar
at 2016-07-08T21:31
at 2016-07-08T21:31