While loop wired output issue

Hi,

Wired output I am getting. Pls let me know what mistake i did on below loop script

paste profile.txt names.txt | while read i j
 
do
 
 echo [Profile$i] >> profiles.ini
 echo Name=$j >> profiles.ini
 echo IsRelative=1 >> profiles.ini
 echo Path=Profiles/$j >> profiles.ini
 
done

Output. But i need only upto Path=Profiles/test2 why it is printing more

[Profile3]
Name=test1
IsRelative=1
Path=Profiles/test1
[Profile4]
Name=test2
IsRelative=1
Path=Profiles/test2
[Profile]
Name=
IsRelative=1
Path=Profiles/
[Profile]
Name=
IsRelative=1
Path=Profiles/
[Profile]
Name=
IsRelative=1
Path=Profiles/
[Profile]
Name=
IsRelative=1
Path=Profiles/
[Profile]
Name=
IsRelative=1
Path=Profiles/
[Profile]
Name=
IsRelative=1
Path=Profiles/
[Profile]
Name=
IsRelative=1
Path=Profiles/
[Profile]
Name=
IsRelative=1
Path=Profiles/
[Profile]
Name=
IsRelative=1
Path=Profiles/
[Profile]
Name=
IsRelative=1
Path=Profiles/
[Profile]
Name=
IsRelative=1
Path=Profiles/
[Profile]
Name=
IsRelative=1
Path=Profiles/
[Profile]
Name=
IsRelative=1
Path=Profiles/
[Profile]
Name=
IsRelative=1
Path=Profiles/
[Profile]
Name=
IsRelative=1
Path=Profiles/

Hi

Little tough to say without having to look at the contents of files profile.txt and names.txt. However, it looks like the files have quite a few blank lines and hence the extended output. If so, removing the blank lines should do.

Guru

I am guessing, one of the input files has a lot of empty lines at the end?

Thanks

yes issue resolved. I have empty lines at the end?