I have files in a directory (/home/user/example) that I need to verify and match. Each file has a control and data file. I want to check if for each file there is a corresponding file of the other. For example, if example.ctl has a match with example.out or example.out has a corresponding file with example.ctl.
I had written a nested for loop and with many if else statements. But this seemed to be far too complex for a basic check like this. I wanted to see if anyone had a better solution.
Example files in directory:
example.ctl
example.out
example_1.ctl
example_1.out
example_2.ctl
example_2.out