in reply to Re: File handling
in thread File handling
perl -pi.bak -e 's/manulation/modification/' file.txt
Actually that will change the first (and supposedly unique) occurrence of 'manulation' in every line: indeed this makes sense, because the OP's request is sloppy to begin with. Anyway, he stresses that the substitution he wants must take place in a "particalur line" and mentions Tie::File, although to the effect of not wanting to use it. Thus I suspect he really wants the substitution to happen on a given line. But then... editi: given by what? If by a line number, say the tenth, then it's easy; you just have to enhance the above to:
perl -pi.bak -e '$.==10 and s/manulation/modification/' file.txt
If it's something different, then you have to tell us.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: File handling
by Anonymous Monk on May 31, 2007 at 03:34 UTC | |
by blazar (Canon) on May 31, 2007 at 07:48 UTC |