i have this code and it is working fine.
Actual issue is to read input from 2 files by line wise and print them as below:-
>cat a.txt
RC1
RC2
RC3
RC4
>cat b.txt
11
22
33
44
Desired output :-
RC1 - 11
RC2 - 22
RC3 - 33
RC4 - 44
If i am using passing of file method,i could not arrive that the desired output .so i am trying other ways .Can you help me if it can be achieved in another method.
Lots of ways, actually, none of which mean slurping entire whole files into memory(usually a mistake).
paste -d "-" file1 file2
exec 5<file1 # Open into FD 5
exec 6<file2 # Open into FD 6
while read A<&5 && read b<&6 # Read from FD 5 and 6
do
echo "$A - $B"
done
exec 5<&- # Close FD 5
exec 6<&- # Close FD 6