|
|
| Perl Monk, Perl Meditation | |
| PerlMonks |
edit a CSV and "in-place" replacementby slayedbylucifer (Scribe) |
| on Jun 22, 2012 at 06:37 UTC ( [id://977784]=perlquestion: print w/replies, xml ) | Need Help?? |
|
slayedbylucifer has asked for the wisdom of the Perl Monks concerning the following question: hello Monks, I need some regex help. I have a csv where in I want to edit the 35th field. In 35th field, I want to replace the "0" which is in the beginning of the string "and" is followed by 10 digits with "+91" and then write the change back. I do not want the output on the console but want to have it written back to the same file in the same field. I thought this would have been an easier one with sed/awk but I could not yet make it work. Here is my thread with the sed/awk exploration: http://stackoverflow.com/questions/11138434/sed-in-place-replacement So, Now I am thinking of doing it with perl. Here is one sample input:
So in above line, the number happens to be the 35th field. I want to change it from "01234567899" to "+912234567899". Please provide your inputs. -Thanks.
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||||||||||||||