Re: [問題] Grep如何抓取前一行後兩行

看板Linux作者 (幽光)時間14年前 (2011/11/26 13:39), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串3/4 (看更多)
我覺得版本的問題吧? 我測試了一下,以下是測試檔: /***************************/ grep_test.txt: AAA BBB CCC DDD EEE FFF GGG /*************************/ 測試結果: bigdick@bigdick:~$ grep "AAA" grep_test.txt AAA bigdick@bigdick:~$ grep -A2 "AAA" grep_test.txt AAA BBB CCC bigdick@bigdick:~$ grep -B1 -A2 "CCC" grep_test.txt BBB CCC DDD EEE bigdick@bigdick:~$ grep -V GNU grep 2.6.3 <---------------你要不要對一下版本?我是用Debian6.0 Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. bigdick@bigdick:~$ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.161.187.250
文章代碼(AID): #1Eq7kath (Linux)
文章代碼(AID): #1Eq7kath (Linux)