I have 2 files with some content/lines.
Example :
cat a.txt
1
2
3
4
cat b.txt
a
b
c
d
Need to get below output using for loop
1 a
2 b
3 c
4 d
I have tried the below script but it gives the wrong output
for i in `cat a.txt`
do
for j in `cat b.txt`
do
echo $i and $j
done
done
1 and a
1 and b
1 and c
1 and d
2 and a
2 and b
2 and c
2 and d
3 and a
3 and b
3 and c
3 and d
4 and a
4 and b
4 and c
4 and d
Kindly help me to do with For loop. Thanks in Advance
paste a.txt b.txt
paste -d ' ' a.txt b.txt
is "the wrong answer" for you, then please also explain why. There is absolutely no need for anyfor
loop to solve this.paste
is not acceptable to you.