By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,847 Members | 1,317 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,847 IT Pros & Developers. It's quick & easy.

can't search and replace

P: 3
Hi,

Can anyone help? I try search the keyword from _V and replace _VDR at the create.bat file and use below perl command but it doesn't work.

perl -pi -i.bak -e 's/_V/_VDR/' create.bat


After execute the above command and all _V not change to _VDR :
rmtshare \\NASP01\GRP_NetwrkOps = "c:\vol\IA01_V001\GRP_NetwrkOps" /REMARK:"Network Operation"


Best regards,

Chung
Feb 7 '08 #1
Share this Question
Share on Google+
5 Replies


KevinADC
Expert 2.5K+
P: 4,059
try removing the i that is right after p in the oneliner you posted and add the "g" modifier to the regexp:

Expand|Select|Wrap|Line Numbers
  1. perl -p -i.bak -e 's/_V/_VDR/g' create.bat
make sure to use the full path to create.bat if necessary
Feb 7 '08 #2

P: 3
Hi KevinADC,

Thanks your reply, but it still not change after try your solution.


Best regards,

Chung
Feb 7 '08 #3

KevinADC
Expert 2.5K+
P: 4,059
Works for me. Don't know what to tell you.
Feb 7 '08 #4

P: 3
Hi KevinADC,

I don't install perl at windows and just only Perl300.dll, Perl.exe and PerlMsg.dll files. Is any missing? Thanks.


Best regards,

Chung
Feb 7 '08 #5

KevinADC
Expert 2.5K+
P: 4,059
Hi KevinADC,

I don't install perl at windows and just only Perl300.dll, Perl.exe and PerlMsg.dll files. Is any missing? Thanks.


Best regards,

Chung
As far as I know you need to install perl. I do not know what perl300.dll is or PerlMsg.dll. perl.exe looks like the main perl executable but there are many other files that come with perl.
Feb 7 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.