Hello ,
I have the folowing scenario :
I have a text file as follows : (say name.txt)
ABC
DEF
XYZ
And I have one more xml file as follows : (say somexml.xml)
<Name>ABC</Name>
<Age>12</Age>
<Class>D</Class>
<Name>XYZ</Name>
<Age>12</Age>
<Class>D</Class>
<Name>DEF</Name>
<Age>12</Age>
<Class>D</Class>
I use each name from text , grep accordingly and extract three tags name,age,class from xml ..
The extraction works fine and so does grep ...but i want to move that in a loop ... i.e. as follows :
for each name in text file
do something ....(grep in xml)
i use the following command :
cat name.txt | while read someLine
set ${someLine}
name=$someLine
grep "$name" somexml.xml
but the problem here occurs during readline coz it reads a newline alongwith the name due to which it cannot grep further in xml .....
So basically i want to remove the trailing newline character.....
(I would kindly acknowledge even better and innovative ways of reading the file)
Hope my problem is clear....
Thanks and Regards,
SD