0

I have two lists I produce using the following commands:

  1. find . -type f -name config.php -exec ls {} \;
    
  2. find . -type f -name config.php -exec grep --files-with-matches some_string {} \; | sort
    

How could I pipe the lists into com -23 so I can see those entries from list1 that aren't contained in list2?

Kamil Maciorowski
  • 69,815
  • 22
  • 136
  • 202
Nick Weavers
  • 131
  • 1
  • 5
  • You didn't specify your shell. If the linked question is not helpful (e.g. if you're using a shell with no support for process substitution) then please [edit] the question, state your shell and the fact you can't use process substitution. We will reopen the question then. – Kamil Maciorowski May 22 '19 at 15:51
  • Few things about your specific approach: (1) Are you sure you need `-exec ls {} \;`? I expect `-print` (or nothing at all) to generate basically the same output. (2) How about `grep --files-without-match` in the first place? Piping to `comm` may be unnecessary (compare [XY problem](https://meta.stackexchange.com/a/66378/355310)). – Kamil Maciorowski May 22 '19 at 16:14
  • Thanks for pointing at the solution. My shells was bash so it is appropriate and it worked. – Nick Weavers May 22 '19 at 16:25
  • Yes, the -exec ls {} \; was unnecessary... I removed it. The --files-without-match would not have given the same result, but thank you for the suggestions. – Nick Weavers May 22 '19 at 16:29

0 Answers0