Tech Support banner
Status
Not open for further replies.
1 - 2 of 2 Posts

·
Registered
Joined
·
1 Posts
Discussion Starter · #1 ·
I want to update existing xml element with new xml element, and write to a new file. I have written the code, but it updates only the last element.
Can you help on this one?.

#!/usr/bin/ksh

if [ $# -ne 1 ]
then
echo "";
echo "Usage: $0 <clf>";
echo "Example: $0 clf.scr";
echo "";
exit;
fi

INCLF=$1;
#OUTCLF="${inclf}.scr";

echo "Enter network_id for clf";
read value1;
echo "input is $value1";

echo "Enter service_id for clf";
read value2;
echo "input is $value2";

echo "Enter order_item_id for clf";
read value3;
echo "input is $value3";

while read line
do
echo "input is $value1";
sed "s/\(<tirksmt:NETWORK_ID>\).*\(<\/tirksmt:NETWORK_ID>\)/\1$value1\2/g" $INCLF > out
echo "input is $value2";
sed "s/\(<serviceId>\).*\(<\/serviceId>\)/\1$value2\2/g" $INCLF > out
echo "input is $value3";
sed "s/\(<orderItemId>\).*\(<\/orderItemId>\)/\1$value3\2/g" $INCLF > out
done < $INCLF
 

·
Alternative Computing, Moderator
Joined
·
2,754 Posts
I have no experience with the korn shell but if you can rewrite this in bash, I may be able to help.
Also, what distro are you running the script on?
 
1 - 2 of 2 Posts
Status
Not open for further replies.
Top