Skip to main content
added 175 characters in body; edited tags; edited tags
Source Link
slm
  • 379.8k
  • 127
  • 793
  • 897

unix replace Replace specified character between two stringstrings?

i have something to accomplish. i need to replace all occurrence of & inside or between <ex> </ex> to #. actual example below:

a & b & c <ex> a & b & c </ex> a & b & c

again, i need to replace all occurrence of & inside <ex> and before </ex>

expected output:

a & b & c <ex> a # b # c </ex> a & b & c

please post the explanation also on how you guys managed to make it.

EDIT#1

Please only provide me with a sed solution since I'm going to run this on an AS400 system and lack the ability to install Perl or any other interpreter.

unix replace specified character between two string

i have something to accomplish. i need to replace all occurrence of & inside or between <ex> </ex> to #. actual example below:

a & b & c <ex> a & b & c </ex> a & b & c

again, i need to replace all occurrence of & inside <ex> and before </ex>

expected output:

a & b & c <ex> a # b # c </ex> a & b & c

please post the explanation also on how you guys managed to make it.

Replace specified character between two strings?

i have something to accomplish. i need to replace all occurrence of & inside or between <ex> </ex> to #. actual example below:

a & b & c <ex> a & b & c </ex> a & b & c

again, i need to replace all occurrence of & inside <ex> and before </ex>

expected output:

a & b & c <ex> a # b # c </ex> a & b & c

please post the explanation also on how you guys managed to make it.

EDIT#1

Please only provide me with a sed solution since I'm going to run this on an AS400 system and lack the ability to install Perl or any other interpreter.

Rollback to Revision 2
Source Link
choroba
  • 49.4k
  • 7
  • 92
  • 118

i have something to accomplish. i need to replace all occurrence of & inside or between (ex)<ex> (/ex) to</ex> to #. actual example below:

a & b & c (ex) a & b & c (/ex) a & b & c

a & b & c <ex> a & b & c </ex> a & b & c

again, i need to replace all occurrence of & inside and<ex> and before </ex>

expected output:

a & b & c (ex) a # b # c (/ex) a & b & c

a & b & c <ex> a # b # c </ex> a & b & c

please post the explanation also on how you guys managed to make it. thanks a lot!

all help will be greatly appreciated!

i have something to accomplish. i need to replace all occurrence of & inside or between (ex) (/ex) to #. actual example below:

a & b & c (ex) a & b & c (/ex) a & b & c

again, i need to replace all occurrence of & inside and before

expected output:

a & b & c (ex) a # b # c (/ex) a & b & c

please post the explanation also on how you guys managed to make it. thanks a lot!

all help will be greatly appreciated!

i have something to accomplish. i need to replace all occurrence of & inside or between <ex> </ex> to #. actual example below:

a & b & c <ex> a & b & c </ex> a & b & c

again, i need to replace all occurrence of & inside <ex> and before </ex>

expected output:

a & b & c <ex> a # b # c </ex> a & b & c

please post the explanation also on how you guys managed to make it.

added 42 characters in body
Source Link
kemaro
  • 47
  • 1
  • 5

i have something to accomplish. i need to replace all occurrence of & inside or between <ex>(ex) </ex> to(/ex) to #. actual example below:

a & b & c <ex> a & b & c </ex> a & b & c

a & b & c (ex) a & b & c (/ex) a & b & c

again, i need to replace all occurrence of & inside <ex> and and before </ex>

expected output:

a & b & c <ex> a # b # c </ex> a & b & c

a & b & c (ex) a # b # c (/ex) a & b & c

please post the explanation also on how you guys managed to make it. thanks a lot!

all help will be greatly appreciated!

i have something to accomplish. i need to replace all occurrence of & inside or between <ex> </ex> to #. actual example below:

a & b & c <ex> a & b & c </ex> a & b & c

again, i need to replace all occurrence of & inside <ex> and before </ex>

expected output:

a & b & c <ex> a # b # c </ex> a & b & c

please post the explanation also on how you guys managed to make it.

i have something to accomplish. i need to replace all occurrence of & inside or between (ex) (/ex) to #. actual example below:

a & b & c (ex) a & b & c (/ex) a & b & c

again, i need to replace all occurrence of & inside and before

expected output:

a & b & c (ex) a # b # c (/ex) a & b & c

please post the explanation also on how you guys managed to make it. thanks a lot!

all help will be greatly appreciated!

Formatting
Source Link
choroba
  • 49.4k
  • 7
  • 92
  • 118
Loading
Source Link
kemaro
  • 47
  • 1
  • 5
Loading