regex - Text replacement in all the files in a directory -
in windows 2008, have multiple files in directory. files having paths contents , texts should replaced other string.find example below:
the files having paths like:
file1:
c:\apps\ etc\a1\x.exe should replaced c:\apps\ exe\x.exe
file2:
c:\apps\ etc\b1\y.exe should replaced c:\apps\ exe\y.exe
i trying find single command replace bold lettered strings mentioned above.
in case of normal strings use below command , works:
perl -i.bak -pe "begin{@argv = map glob, @argv} s/string1/string2/g" ./*.txt
but current requirement seems use regular expression not able find solution.
just replace etc\ followed \ again exe:
's/etc\\[^\\]*\\/exe\\/g'
Comments
Post a Comment