tags:

views:

74

answers:

1

I have the following looop

for i in $(cat numbers.txt);
do echo $i;
wget -a output.txt --no-check-certificate http://localhost:9001 --post-file=netev.xml;
done

but the netev.xml has a fieled which is defined by the variable $1, this $1 needs to corrospond to value of i for that iteration......

how can i make this work?

thanks

+1  A: 

Create a template netev.xml where the value is replaced by a token that is unlikely to occur naturally in the file (say, IVALUE) and use sed to substitute $1 to IVALUE in the template.

$ cat > template
toto = IVALUE
titi
$ sed s/IVALUE/foo/ < template 
toto = foo
titi
Pascal Cuoq
thanks I changed the $1 in the xml file to IValue and did the following seems to workthanks==================================================================for i in $(cat numbers.txt);do echo $i;sed 's/IValue/'$1'g' netev.xml > netevMOD.xml;wget -a output.txt --no-check-certificate http://localhost:9001 --post-file=netevMOD.xml;done==============================================================
matt123