title: using find and sed in Windows 7 to recursively modify files
body: <p>I'm trying to use find in Windows 7 with GNU sed to recursively replace a line of text in multiple files, across multiple directories.  I looked at <a href="https://stackoverflow.com/questions/60034/how-can-you-find-and-replace-text-in-a-file-using-the-windows-command-line-enviro">this question</a> but the PowerShell solution seems to work with only one file, and I want to work with all files with a certain extension, recursively from the current directory.  I tried this command:</p>
  
  <pre><code>find "*.mako" -exec sed -i "s:&lt;%inherit file="layout.mako"/&gt;:&lt;%inherit file="../layout.mako"/&gt;:"
  </code></pre>
  
  <p>But that gives me a bunch of crap and doesn't change any files:</p>
  
  <pre><code>---------- EDIT.MAKO
  
  File not found - -EXEC
  File not found - SED
  File not found - -I
  File not found - LAYOUT.MAKO/&gt;:&lt;%INHERIT FILE=../LAYOUT.MAKO/&gt;:
  </code></pre>
  
  <p>How can I do this?  It seems like I should have all the tools installed that I need, without having to install Cygwin or UnixUtils or anything else.</p>
  
  <p><strong>Edit:</strong> okay, working with GNU find, I still can't get anywhere, because I can't get the find part to work:</p>
  
  <pre><code>&gt; gfind -iname "*.mako" .
  C:\Program Files (x86)\GnuWin32\bin\gfind.exe: paths must precede expression
  &gt; gfind . -iname "*.mako"
  C:\Program Files (x86)\GnuWin32\bin\gfind.exe: paths must precede expression
  &gt; gfind -iname "*.mako" .
  C:\Program Files (x86)\GnuWin32\bin\gfind.exe: paths must precede expression
  </code></pre>
  
  <p>I was originally not using GNU find in Windows 7 because of <a href="https://superuser.com/questions/312135/why-wont-gnu-find-work-recursively-on-windows-7">this question</a>.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>I tried the following, but sed doesn't see any input files this way:</p>
  
  <pre><code>&gt; ls -r | grep mako | sed -i 's/file="layout.mako"/file="..\/layout.mako"/'
  sed.exe: no input files
  </code></pre>