Replace content of previous line after finding a match using sed
<p>I am trying to replace content in the previous line of a search. </p>

<p>My file: </p>

<pre><code>&lt;RECORD&gt;
&lt;TOKEN data = "670"/&gt;
&lt;ID data ="10647043"/&gt;
&lt;NAME data="m11111"/&gt;
</code></pre>

<p></p>

<p>Here if I search for m11111, then I need to go to the previous line and replace 10647043 with a different value. Sed that I tried: </p>

<pre><code>sed '/m11111/{g;/=/s/=.*/="9283"\/&gt;/g;};h' test.txt
</code></pre>

<p>Is there a way with sed? If not with sed, any other way to do it ? </p>

<p>Thanks
Ajay</p>