lakshmi nrusimhan wrote:

> Consider the following lines:
> 
> Apple
> Mango
> Banana
> Orange
> 
> I want to replace line 1, line 2 i.e. (Apple, Mango)
> with hello1\nhello2\nhello3\n.
> 
> The output should be:
> hello1
> hello2
> hello3
> Banana
> Orange
> 
> I tried something like this:
> $t="Apple,Mango";
> perl -pe perl's/$t/hello1\nhello2\nhello3\n/' testvi >
> o1
> I am not getting the above mentioned output.


you are getting what you're asking for.

$t is 'Apple,Mango'.  but you don't have a line that matches that.

do you want to replace the 1st 3 lines with your 'hellox' text, or do 
you need to replace every instance of 'Apple' and 'Mango' with one 
'hellox'?  both tasks are not the same thing.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to