I have a list of base files:

```
file1.txt 
file2.txt 
file3.txt 

```

and a list of target files: 

```
target1.txt
target2.txt 
target3.txt

```

and I want to use bash to perform the following command using a loop: 

```
grep -wf "file1.txt" "target1.txt" > "result1.txt" 
grep -wf "file2.txt" "target2.txt" > "result2.txt" 

```

The files will all have the same name besides the final integer, which will be in a series (1:22).
['https://Stackoverflow.com/questions/61958842', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/13456823/']
With a for loop:

```
for((i=1; i<=22; i++)); do
  grep -wf "file$i.txt" "target$i.txt" > "result$i.txt" 
done

```
Do them all in parallel with **GNU Parallel**:

```
 parallel 'grep -wf file{}.txt target{}.txt > result{}.txt' ::: {1..22}

```