While Loops Multiple File

view full story

http://www.unix.com – Guru, I try to make a loop of 2 files, Input File1.txt: Code: 1 2 File2.txt: Code: A B C A, B and C is a file name, inside A Code: X Y Z Expected Output A.1 Code: X 1 Z A.2 Code: X 2 Y B.1 Code: X 1 Z B.2 Code: X 2 Z My script is : Code: while read lineA; do   while read lineB; do     sed '2d' $lineB  | awk 'NR==2{print $lineA}1' > $lineB.$lineA   done < File2.txt done < File1.txt However, what I got is A.1 Code: X Z Z A.2 Code: X Z Z Any help regarding my error ? (HowTos)