shahrahulb
asked on
replace
i have a file temp.txt which has a line
ENVELOPE = "hkdscj@ljld.com";
in my perl script;send-multi.pl
my $user = "rshah1\@yahoo.com";
`perl -i -wpe 's/ENVELOPE = ".*"/ENVELOPE = "$user"/g' send-multi.pl`;
i want to replace hkdscj@ljld.com with rshah1\@yahoo.com
ENVELOPE = "hkdscj@ljld.com";
in my perl script;send-multi.pl
my $user = "rshah1\@yahoo.com";
`perl -i -wpe 's/ENVELOPE = ".*"/ENVELOPE = "$user"/g' send-multi.pl`;
i want to replace hkdscj@ljld.com with rshah1\@yahoo.com
ASKER
not working
or just run from the command line:
perl -i -pe 's/ENVELOPE = ".*?"/ENVELOPE = "rshah1\@yahoo.com"/g' temp.txt
perl -i -pe 's/ENVELOPE = ".*?"/ENVELOPE = "rshah1\@yahoo.com"/g' temp.txt
Is
ENVELOPE = "hkdscj@ljld.com";
The exact line in temp.txt?
Could those spaces be tabs?
s/(ENVELOPE\s*=\s*)".*?"/$ 1"rshah1\@ yahoo.com" /g
ENVELOPE = "hkdscj@ljld.com";
The exact line in temp.txt?
Could those spaces be tabs?
s/(ENVELOPE\s*=\s*)".*?"/$
>`perl -i -wpe 's/ENVELOPE = ".*"/ENVELOPE = "$user"/g' send-multi.pl`;
Do you want to change the entry in temp.txt or send-multi.pl??
Do you want to change the entry in temp.txt or send-multi.pl??
ASKER
in send-multi.pl
in my perl script;send-multi.pl
my $user = "rshah1\@yahoo.com";
`perl -i -wpe 's/ENVELOPE = ".*"/ENVELOPE = "$user"/g' send-multi.pl`;
this is not working
in my perl script;send-multi.pl
my $user = "rshah1\@yahoo.com";
`perl -i -wpe 's/ENVELOPE = ".*"/ENVELOPE = "$user"/g' send-multi.pl`;
this is not working
you say that ENVELOPE line is contained in temp.txt?? or is it in send-multi.pl??
Apologies, but im getting slightly confused by what you require
Manav
Apologies, but im getting slightly confused by what you require
Manav
ASKER
i m really sorry, its my fault.
my script temp.pl has the following 2 statements
my $user = "rshah1\@yahoo.com";
`perl -i -wpe 's/ENVELOPE = ".*"/ENVELOPE = "$user"/g' send-multi.pl`;
and envelope is in send-multi.pl
my script temp.pl has the following 2 statements
my $user = "rshah1\@yahoo.com";
`perl -i -wpe 's/ENVELOPE = ".*"/ENVELOPE = "$user"/g' send-multi.pl`;
and envelope is in send-multi.pl
Are you running this on a Windows or a Unix OS??
ASKER
unix
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
awesome!!!!!!!!!!!!!!!
ASKER
what does \Q and \E do
They will quote all metacharacters occuring between the \Q and the \E
ASKER
thx :-)
{local @ARGV=("temp.txt"); local $^I='';
while( <> ){
s/ENVELOPE = ".*?"/ENVELOPE = "$user"/g;
print;
}
}