goshainganj
2013-02-15 10:51:30 UTC
@echo off
dir /b /s | find ".pscx" > mydir.txt
pushd .
for /F "delims==" %%a in (mydir.txt) do (
echo "%%a"
sed -i "s/1.0101/1.0400/g" "%%a" > junk.txt
move junk.txt "%%a"
)
popd
del mydir.txt
-------------------
I wrote the above code to change 1.0101 to 1.0400 in all .pscx files in all directories from where I am executing this batch file.
I read SED manual and it said -i option would directly change .pscx files but it complained. So I directed the output to junk.txt. I wanted to move junk.txt back to .pscx file. It is this part of the above script that's not working.
Any suggestions why -i is not working and how I can make the above to work?
Thanx
Kailash
dir /b /s | find ".pscx" > mydir.txt
pushd .
for /F "delims==" %%a in (mydir.txt) do (
echo "%%a"
sed -i "s/1.0101/1.0400/g" "%%a" > junk.txt
move junk.txt "%%a"
)
popd
del mydir.txt
-------------------
I wrote the above code to change 1.0101 to 1.0400 in all .pscx files in all directories from where I am executing this batch file.
I read SED manual and it said -i option would directly change .pscx files but it complained. So I directed the output to junk.txt. I wanted to move junk.txt back to .pscx file. It is this part of the above script that's not working.
Any suggestions why -i is not working and how I can make the above to work?
Thanx
Kailash