Search code examples
filesearchgrepack

How can I make ack search through a list of files listed in a text file?


I have foo.txt that contains a list of file names, delimited by newline. What I want to do is to use ack to search through the files listed in the foo.txt. How can I do that?


Solution

  • xargs -0 -n 1 grep search-string < foo.txt 
    
    # -0 to handle filenames with spaces
    # -n 1 means process a single file at a time