Find lines with "A" then change "E" to "X" same line

I have a bunch of random character lines like ABCEDFG. I want to find all lines with "A" and then change any "E" to "X" in the same line. ALL lines with "A" will have an "X" somewhere in it. I have tried sed awk and vi editor. I get close, not quite there. I know someone has already solved this one.

Would this work?

 sed -e '/A/s/E/X/g'

Using awk

echo "ABCEDFG" | awk '/A/ {gsub("E","X")}1'
ABCXDFG

Is "A" always at the begin of line? Then try:

sed 's/^\(A[^E]*\)E/\1X/' file

ALL of the samples you gave me work fine. Many thanks.
I am working with a 500,000 record file, about 18meg, and the commands which work just fine on a small file are hanging on the large one. One has been "running" for two days. I have tried this on both SUN Solaris, and AIX flavors of Unix. Can anyone suggest something? Below are the commands I use. Again, they work just fine on the small test files I have used. It could be the size, or there could be something unique about the data in the larger file. Please help.
I have tried:

cat sun-file1.xml     | sed -e '/DESCRIPTION=/s/"/@@@"/g' > sun-file2.xml $

and

sed -e '/DESCRIPTION=/s/"/@@@"/g' <sun-file1.xml >sun-file2.xml

Pleas use code tags as required by forum rules!

Anchoring - if possible - sometimes really speeds things up, as the regex doesn't need to be searched in the whole line but in certain places. So, if "DESCRIPTION" always shows up in a constant position, count that relative to the BOL and use "^" in your regex.

EDIT: And, I guess, it scans lines twice: one for the address (/DESCRITPTION/), and then again for the occurrences of /"/. Maybe you can improve that:

sed 's/\(DESCRPITION[^"]*\)"/\1@@@"/' file

?

Sorry about the code tags. Now I understand and will use them in the future.
The first "find" is necessary. I only want to make the change in lines which contain the first "find" field. Once I find a line with "A" I want to change "E" to "X" in the same line. No way to change that (that I know of).
And there is some variation in where the "A" field is found.
I have it working fine in my simple short test file, but the long file it seems to hang on something. Very frustrating, so close and yet so far.

Why don't you post an abbreviated, still representative, sample of your input file?

I'm new here. Not sure how to upload a file, and do not want to upload one which is too large. It is 18 meg in full. Is that too big? Problem is I do not know exactly where in the file it is going bad.

zip (compress) the file if possible.

Don't post the entire file. Post several lines with different patterns to change/not to change in it. And, as I understand it, it's not going wrong, it's just slow?