Why doesn't grep -lv work?

Viewed 176

I want to print out the name of a file if and only if it does not contain the string foo. However, if file contains foo and I run this

grep -lv 'foo' file

file is outputted. Why does this happen and what can I do to work around it?

3 Answers
Related