If you're running ack 2.x, you can use the -x option to get input from STDIN, much like xargs.
ack -g search-this-one.html | ack -x pattern
The ack -g
says "Find any text files with names that match search-this-one.html
", and then that's piped into ack -x
which takes its list of input files from STDIN.
Also works for searching for filenames with regex:
ack -g '\.*.conf$' | ack -x searchString