I want to find and replace a pattern where
text=\"
hold1
hold2
some text
some text
...
... more data
this1
that
Using sed
you can try something like:
sed -e ':a;N;$!ba' -e 's#<file.*</file>#<sometext>\nvalue1\n</sometext>#' file
My sed
is a little rusty but what we are doing here is using :a;N;$!ba
we effectively create one long line in pattern space so that we can apply the second expression which does your substitution.
This will probably need GNU sed
$ cat file
hold1
hold2
<file option1='one'>
some text
some text
more data
</file>
this1
that1
$ sed -e ':a;N;$!ba' -e 's#<file.*</file>#<sometext>\nvalue1\n</sometext>#' file
hold1
hold2
<sometext>
value1
</sometext>
this1
that1