I want to use sed to remove a string with capitals that is followed by a comma, then space or just a space then a country name that begins with a captital. I achieve this at present with this pair of sed commands;
Code:
sed 's/[A-Z]\+ \([A-Z]\)/\1/'|sed 's/[A-Z]\+, \([A-Z]\)/\1/'
So for example, a file, "infile" with the lines
|
UCTEXT, Australia
MOREUCTEXT Zambia
will output
Australia
Zambia
Is there a way to do this with a single sed regex? It would be nice if something like below existed
Code:
sed 's/[A-Z]\+[" ",", "] \([A-Z]\)/\1/'