leelu: In addition to roboticus's comment about not showing any code, please note that you're not really showing any data either — at least not in a form that can easily be interpreted. Please Update your original post to use <c> ... </c> or <code> ... </code> tags around code and data, (and input/output, if any). Please see Markup in the Monastery and Writeup Formatting Tips.
Give a man a fish: <%-(-(-(-<
| [reply] [d/l] [select] |
leelu:
If all records are updated, then read only one record at a time, and perform your substitution only on the first record. You don't show code, so I can't tell you exactly what you're doing wrong. (You could be reading in the entire file and doing the substitution globally, you could be substituting in a loop. Hard to say without seeing the code.)
...roboticus
When your only tool is a hammer, all problems look like your thumb.
| [reply] |
I have tried with s/text/update/g; all records are updated instead of first record Why do you think this happened, what do you think needs to change to fix it?
How is the line record that needs to change substitution different from all the other records, what uniquely identifies that one record?
Think about it, say it out loud, write down the answer and share with us
Then visit http://perldoc.perl.org/perlintro.html#More-complex-regular-expressions
| [reply] |