A very general question.
How could we select 2 input files based on their names and apply any command to them automatically?
I have a directory containing 2,000 files:
I want to apply automatically
a command (let's say the "join" command) to specific pairs of files, both containing the same "number" and the same "color".
Just to avoid writing 1,000 times the same command with different files,
join file1_red.tab file1_red_info.temp
join file2_blue.tab file2_blue_info.temp
join file3_green.tab file3_green_info.temp
join file1000_black.tab file1000_black_info.temp
is there any way to use the names of files to run this join (or another) command?
Maybe using a conditional expression (in a for loop) in this spirit:
# if ( 2 file names contain the same "number" and "color")
then (apply join command to them)
I know awk has a built-in variable "FILENAME", but it would mean that all the command we want to apply to these files must be written with awk, which is sometimes complicated .