2012年11月21日星期三

In UNIX grep a phrase and adjacent lines

http://www.experts-exchange.com/OS/Linux/Q_26606094.html

grep -A2 SELECT

That will return the line matching and the next two lines, found the answer here - 

http://linux.byexamples.com/archives/304/grep-multiple-lines/

You can also do

grep -A2 -i select

so it matches upper or lower case (-i is ignore case)

没有评论:

发表评论