I am trying to run a command which requires two files from a pair to be separately specified (Left and Right). Each pair of files has a different basename followed by .1 for left or .2 for right (e.g. A.1.txt, A.2.txt, B.1.txt, B.2.txt). There are over 100 such pairs, so I'd like to call them in a loop, rather than writing out the command >100x, and the basenames are all unique and long, so I'd rather not write them all out, just iterate over every pair in the directory.
Here's what I've been trying, which doesn't work:
*for file in /*.1.txt
echo $(basename "$file") | sed 's/.1.txt/.2.txt/' > file2
do command -left "$file" -right "$file2"
done*
Any suggestions very much appreciated!