Remove trailing empty spaces within a quote

Platform: Oracle Linux 6.5
I have a file with hundreds of values enclosed in single quotes like below. I want the trailing empty spaces before the ending quote to be removed. Expected output shown below. Can this be done using good old vi editor ? Or should I use sed or awk for this ?

$ cat someStings.txt
'ABC  '
'CDE  '
'FGHIJKL  '
'MN  '

Expected output:

'ABC'
'CDE'
'FGHIJKL'
'MN'
 

Note : unix.com's editor is not working well with my Firefox or Chrome browser. Because of this , I see a preceeding space before 'ABC' in the 'Exprected output' . Please ignore this.

For your special case given above, try

awk '{sub (/ *\047$/, "\047")} 1' file

It doesn't account for leading space/quote combinations nor for those not at line end.

$ cat test.txt
'ABC  '
'CDE  '
'FGHIJKL  '
'MN  '
'TEST HELLO   '
' HI TEST TXT   '


$ sed "s, *'$,',g" test.txt
'ABC'
'CDE'
'FGHIJKL'
'MN'
'TEST HELLO'
' HI TEST TXT'

Hello kraljic,

Following may also help you in same too.

perl -p -e "s/ *'/'/g"   Input_file

Output will be as follows.

'ABC'
'CDE'
'FGHIJKL'
'MN'
 

Thanks,
R. Singh

Hi kraljic,
As to your question of whether or not this can be done "using good old vi editor", the answer is yes. The command:

:g/  *'$/s//'/

will do it. And, of course, this also means that if you're using the good old ed or ex editors, you can also accomplish the same thing with the command:

g/  *'$/s//'/