Complicated string substitution

Horacius ReX horacius.rex at gmail.com
Wed Feb 13 18:02:05 EST 2008


Hi,

I have a file with a lot of the following ocurrences:

denmark.handa.1-10
denmark.handa.1-12344
denmark.handa.1-4
denmark.handa.1-56

...

distributed randomly in a file. I need to convert each of this
ocurrences to:

denmark.handa.1-10_1
denmark.handa.1-12344_1
denmark.handa.1-4_1
denmark.handa.1-56_1

so basically I add "_1" at the end of each ocurrence.

I thought about using sed, but as each "root" is different I have no
clue how to go through this.

Any suggestion ?

Thanks in advance.



More information about the Python-list mailing list