0

I am new to bash. I need some help with loops.

I want a loop to read the variables from two different files and perform an action. For example: I want to supply two files to the 'for' loop -

file1 contains the first names (each word in new line)

Peter
Mary

file2 contains second names (each word in a new line)

Parker
Jane

and i want to achieve something like this -

for i in $(cat file1), j in $(cat file2)

do

echo $i $j 

done

Expected output:

Peter Parker 
Mary Jane 

If someone could tell me how to achieve the above in bash that will be great.

TIA

tutar
  • 11
  • 1

0 Answers0