News for hackers. Stuff that matters.
Re:Beyond grep: ack, a code search tool for programmers by clumsysmurf on Saturday July 20, 2013 @05:01PM (#6076557)
Anyone know of a tool like ack/ag which also lets me search for a term in proximity to another?" For example, find <foo> within 5 lines of <bar>"
Re:Beyond grep: ack, a code search tool for programmers by ekns on Saturday July 20, 2013 @05:16PM (#6076610)
You could do this with grep or ack or ag:

  grep bar -A 5 -B 5 files... | grep foo
-A n prints n lines following the match (bar) and -B n prints n lines before the match.
Re:Beyond grep: ack, a code search tool for programmers by bencoder on Sunday July 28, 2013 @06:03AM (#6116217)
-C x does the same as both -A x and -B x together

(A - after, B - before, C - context)

Re:Beyond grep: ack, a code search tool for programmers by andrelaszlo on Saturday July 20, 2013 @05:12PM (#6076598)
I guess you could setup Sphinx to index your code :) "If it's worth doing, it's worth overdoing!"

http://sphinxsearch.com/