我覺得版本的問題吧?
我測試了一下,以下是測試檔:
/***************************/
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