I have a file of the form bulandshahara   b u l a n d sh a h a r acaandapura  c aa n d a p u r aI have to remove the occurrence of a space followed by a if this pattern appears at the last of any line.My expected output would be bulandshahara   b u l a n d sh a h a rcaandapura  c aa n d a p u rHow can I do this?I visited Remove characters if they do not follow specified patterns but it was about deleting characters if they did not follow the pattern.My question is to remove characters at the end of the line if they follow the pattern that I have specified. 
remove the last character of the line if it is a
text processing