The original poster sent me additional question by personal message. Since there is nothing private in this message and in my answer, I copy the whole exchange below, for the benefit of others who may want to add information.
===== QUOTE =====

Envoyé par
o.tarki
but in my situation we did nont now the actual value in 06870565 perl -pi -e "s/<acc1:SubscriberNo>06870565<\/acc1:SubscriberNo>/<acc1:SubscriberNo>073332<\/acc1:SubscriberNo>
so i want to change the contenant for TAG acc1:SubscriberNo to the new value stored in some variable like my $new_tag=073332.
In this case, you can do something like this, assuming what you want to replace is a telephone number starting with "06":
perl -pi -e 's/<acc1:SubscriberNo>06\d{8}<\/acc1:SubscriberNo>/<acc1:SubscriberNo>073332<\/acc1:SubscriberNo>/;'
This will replace:
- <acc1:SubscriberNo>
- followed by 06 and 8 more digits
- folloowed by <\/acc1:SubscriberNo>
with:
- <acc1:SubscriberNo>
- followed by 073332
- followed by <\/acc1:SubscriberNo>
I assume that's what you are looking for.
However, I think that your message and my answer are both better fit in the public forum rather than in a personal message, and, since there is nothing personal ot private in our communications, I'll take the freedom to copy this message exchange on the forum. This will enable others to give additional advice if needed.
===== UNQUOTE =====
Partager