Hi Akshay,
Now Your command gives me output as follows:
-----------------------------------
<!-- outputEncoding The encoding to use for the page that results -->
<!-- from the SSI processing. [UTF-8] -->
<!-- -->
black
<servlet>
<servlet-name>ssi</servlet-name>
<servlet-class>
</servlet-class>
---------------------------------------------------------------------
My original file is as follows(Including only block which is concerned for the editing:
--------------------------------------------------------
<!-- allowExec Is use of the exec command enabled? [false] -->
<!--
<servlet>
<servlet-name>ssi</servlet-name>
<servlet-class>
org.apache.catalina.ssi.SSIServlet
</servlet-class>
--------------------------------------------------------
Output should have looked like this after executing your command
------------------------------------------------------------
<!-- allowExec Is use of the exec command enabled? [false] -->
<servlet>
<servlet-name>ssi</servlet-name>
<servlet-class>
org.apache.catalina.ssi.SSIServlet
</servlet-class>
---------------------------------------------------------
I wanna replace <!-- between allowExec and SSIServlet. there are multiple occurrence of the block allowExec and SSIServlet. so wanna replace it in first occurrence only.
---------- Post updated at 11:23 PM ---------- Previous update was at 07:48 PM ----------
Hi Akshay,
Your command which you posted very first time is working fine but it replaces the text from the line which contains first matching pattern along with replacing it in between the lines containing the first and second pattern matching lines. I will modify my input file to explain the scenario.
For example:
my input file is :
red white
yellow
grey
white
blue
red
pink
violet
white
I want to have output as follows after search and replacement:
red white
yellow
grey
black
red
pink
violet
white
But the script which you posted first time generates the output as follows:
red black
yellow
grey
black
blue
red
pink
violet
white
Regarding the script which you posted second time, it produces irrelevant results.
Please modify your first script only and let me know to achieve desired output.