0

I am trying to use findutil / sed / grep in windows to look for a particular file in all drives, look for a substring in that file and replace it with a new substring.

From what I have worked out, I have to do this one drive at a time and then cd to the next drive and run again. I also get a missing argument to 'exec'.

C:\findutils\bin\find ./ -name "particularfile.abc" -type f -exec "C:\SED\bin\sed.exe" -i -e 's/Old_String_Is_A_Url_With_/_ForwardSlash_in_it/New_String_Will_Have_Old_String_With_:PortNumber_Added/g' {} \;

Can anyone help me solve this please?

Thanks

  • can't help with your `exec` issue, but a normal unix find will take a list of starting paths, try `find c:\path\to\start d:\path\to\start ... -name ...` . Good luck. – shellter Aug 27 '14 at 23:30

1 Answers1

1

Try using a different delimiter, sed can use something other than the forward slash for substitution:

sed 's/string/changed/' is the same as sed 's#string#changed#'