<blockquote>2009/8/20 JLMS <span dir="ltr"><<a href="mailto:jjllmmss@googlemail.com">jjllmmss@googlemail.com</a>></span></blockquote><div>
<div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Why not use a language created to deal with this kind of problems?<div>
Perl and awk small scripts can be put in place to deal with this in<div>
short time and IMHO are more legible than other alternatives.<div>
<div>
-----<div>
#!/bin/awk<div>
BEGIN { previous="NO";NEWLANG="pt"}<div>
$1=="[Lang_1]" {previous="YES"}<div>
$1 ~ /^Lang=/ && previous=="YES" { $1="Lang="NEWLANG;previous="NO";print}<div>
-----<div>
</div></div></div></div></div></div></div></div></div></div></blockquote><div>Some alternative solutions:</div><div></div><div> sed '/\[Lang_[0-9]\]/ { n; s/Lang=.*$/Lang=pt/ }' testfile</div><div> awk '/\[Lang_[0-9]\]/ { print; getline; if ($0 ~ /Lang=/) $0="Lang=pt" }1' testfile</div>
<div></div><div>Regards,</div><div>Andrew.</div><div> </div></div></div>