1

I'm working on a script to help me identify matching lines across multiple files. I've had luck with the comm command:

comm -12 <(sort file1.txt) <(sort file2.txt) 

This works and can be daisy-chained to expand to X number of files. My problem is that anything more than two files starts becoming very unreadable. I'm wondering if there is a sleeker option available or if I should dig in and write a script to do the work for me. It'd be a simple loop and maybe a prompt to collect file names.

I have a working solution just trying to see if there is a better way that doesn't involve reinventing the wheel. Thoughts appreciated.

Yusif_Nurizade
  • 133
  • 1
  • 12

0 Answers0