1

Is it possible to ask ack to search and include results from multiple root directories, rather than searching from the current shell working directory?

Joshua Goldberg
  • 5,059
  • 2
  • 34
  • 39

1 Answers1

2

Yes, you can specify any number of files or directories you want to search.

Look at the first line of ack --help.

Usage: ack [OPTION]... PATTERN [FILES OR DIRECTORIES]

(The ack manpage has a similar usage statement)

So you can do

ack needle this_haystack/ that/haystack/ other/haystack*.txt
Andy Lester
  • 91,102
  • 13
  • 100
  • 152