in reply to Substitution of text within a file

You can't do that that way. You need to read the whole file, substitute what you need, and rewrithe the whole file.

Alternatively, you can achieve your target by using this, directly from the command line:

perl -pi -e's/\|(\d+)$/|+615$1/ if /^0001/' personel.txt

You need to specify the ID of the person you need to change instead of 0001.

Hope this helps!

Michele.

Update: I forgot to include the condition, now I fixed.

Replies are listed 'Best First'.
Re: Re: Substitue!
by Skeeve (Parson) on Jun 06, 2003 at 08:06 UTC
    That would change EVERY phone number not just one.

    Update: Okay ;-)