SED: language translation of a program

Hi people!

I'm a bit noob at sed so I ask you for some help :frowning:

I'm trying to automatically translate some files of a program, which has some lines of this style:

$string['identifier'] = 'A text line';

For example in this line:

$string['date'] = 'The date entered: <strong>$a</strong> does not correspond to the format shown in the example.';

I want to replace the string 'date' from the line but it should not affect to the string index. For example, replacing date with DATE should result only in:

$string['date'] = 'The DATE entered: <strong>$a</strong> does not correspond to the format shown in the example.';

(notice that $string['date'] must not replaced)

I've been trying a bit with sed, and I almost got something...

sed -e "s/$string\['\([a-z_0-9]\)'\] = '\([^']\)'/$string\['\1\'] = '\2'/g"

but I dont know how to replace the content readed in \2 :(.

Any1 can help me?

Thank you very much!

sed -e 's/ date / DATE /g' file

or

perl -p -i -e 's/ date / DATE /g' file

Using awk....

 
awk '{gsub (/ date /, " DATE "); print}' file