0

I use grep -L to get a list of files that do not contain a certain string. How can I see the content of those files? Just like:

grep -L "pattern" | cat

aldorado
  • 4,394
  • 10
  • 35
  • 46

2 Answers2

2

You can use xargs:

grep -L "pattern" | xargs cat

As read in man xargs --> build and execute command lines from standard input. So it will cat to those file names that grep -L returns.

fedorqui
  • 275,237
  • 103
  • 548
  • 598
1

You can use cat and use the output of grep -L...

cat $(grep -L "pattern" *.files )
iamauser
  • 11,119
  • 5
  • 34
  • 52