0

I am trying to do the following 1. Find all files that contain the word gold 2. Find all files that contain the word sheep 3. Find the intersection of 1 and 2 above (those files that contain the word gold and sheep)

Here is how I am trying to do this in bash

comm -12i < (grep -l gold * | sort) < (grep -l sheep * | sort)

but I get the following error

-bash: syntax error near unexpected token `('

A space after '(' doesn't help, and neither does taking it off. Why is this a problem and how do I solve it?

max_max_mir
  • 1,494
  • 3
  • 20
  • 36

1 Answers1

1

You were very close:

A space after '(' doesn't help, and neither does taking it off. Why is this a problem and how do I solve it?

The space in front of the ( has to be deleted.

comm -12 <(grep -l gold * | sort) <(grep -l sheep * | sort)

On my system comm has no -i option, so I erased the i too.

Socowi
  • 25,550
  • 3
  • 32
  • 54