Reputation: 1746
I'm trying to run ack in my current directory with the keyword to be each line of a text file, and I tried the following command on the command line:
cat ~/temp/imageFileNames.txt | while read line; do ack "$line"; done
However, no output was produced at all, even though each line individually produces output if I run ack on it manually. What's the problem with this command?
Upvotes: 0
Views: 324
Reputation: 3255
ack
works on whole files, line-by-line. For this, just do:
ack "$line" ~/temp/imageFileNames.txt
And it should print out all lines that contain whatever you put for "$line". Check the docs for a better usage description than I can give: http://linux.die.net/man/1/ack
Upvotes: 1