Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Substitue!

by arthas (Hermit)
on Jun 06, 2003 at 08:04 UTC ( [id://263615]=note: print w/replies, xml ) Need Help??


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 ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://263615]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-19 07:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found