Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: need help in editing multiple word in a file

by pvaldes (Chaplain)
on Nov 18, 2012 at 21:12 UTC ( #1004460=note: print w/ replies, xml ) Need Help??


in reply to need help in editing multiple word in a file

>I want to replace some words in a file

ok

>In words are present in whole file. But starting of each line in file is by different word so i am using a file in which first character of line at which i wanna do replacement is written

mmmh? I wonder how you could have a file with unwritten characters. Do you want to match only the first character?

>and along with it replaced word is given ( i name it match file)

uh?

sorry, I get lost, can't understand what you want to do exactly

Could we have a small example with some data


Comment on Re: need help in editing multiple word in a file
Re^2: need help in editing multiple word in a file
by vkp (Novice) on Nov 19, 2012 at 17:40 UTC

    consider this example: lion is brave animal. cat is brave animal. dog is brave animal. in this i want to change brave by frightened only for cat. so i need to match cat and replace brave with frightened. So match file is like: cat frightened . Thanks.

      Ok, so how do you propose deciding which word in the string:

      cat is brave animal

      should be replaced by 'frightened'?

      In other words, is this also acceptable:

      cat frightened brave animal

      ?

      Update: de-gobbledegooked, I hope...

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (20)
As of 2015-07-06 18:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (80 votes), past polls