I have two files file a.) xmlFile.xml b.) emails.txt
xmlFile.xml has the following structure repeated multiple times
<gname>Office</gname>
<uname>person</uname>
emails.txt has list of email addresses
[email protected]
[email protected]
...
What I want to accomplish is to replace "person" in xmlFile.xml with subsequent value taken from emails.txt
I have tried
# while read email ; do sed "s/person/$email/g" xmlFile.xml > xmlFile.new; done < emails.txt
However I endup with file that has all "person" values replaced with the last email from emails.txt
Thanks, Filip