I have a file with text as
Afghanistan=+93
Albania=+355
Algeria=+213
American Samoa=+1
Andorra=+376
Angola=+244
It has all the country list and its dialing code.
I want to replace:
Afghanistan=+93
with Afghanistan(+93)=+93
I can get the selection pattern as =\+[0-9]*
, but what will be replacement pattern string?
I know of \1
that is the captured match for selection but it don't seem to work for sed
. So the regex needs to have selection.
How can I do that using sed or any other unix tools?