regex - replacing a string in all file in perl in windows -


i want replace string string in files in windows. files same extension. tried following perl 1 liner command seems "*" not working windows.

perl.exe -pi.bak -e "s/hello/abcd/ge" c:\users\jamimb\desktop\test\*.tmp 

so please help.

you can expand command line parameter explicitly within perl using glob.

also, /e ("eval") modifier on substitution wrong in instance. if strict in place cause bareword not allowed error, without it no-op abcd evaluates 'abcd'.

try this

perl -i.bak -pe "begin{@argv = map glob, @argv} s/hello/abcd/g" c:\users\jamimb\desktop\test\*.tmp 

Comments