title: Find and replace a word in all the files, which is falling under a searching criteria at Unix
body: <p>I want to replace a word in all the files inside all the sub directories, which satisfy some criteria.</p>
  
  <p>Below is the elaborated situation.</p>
  
  <blockquote>
    <p>I have to replace all the Word having case insensitive word like
    {classy, CLASSY, cLassy ,..} to word "Vintage". Also I only need to
    replace it where it have a case insensitive word "insert" or "INSERT".</p>
  </blockquote>
  
  <p>So if i have 2 files having below content.</p>
  
  <pre><code>File1.txt
  asd asdsd INSERT asdasd classy
  asddsdff sdf sdff sdf  CLASSY
  sfre asfert asdd asd insert asdgweg 
  qwe asfer wrererw  werer wewer INSERT CLassy
  
  
  File2.txt
  fhfgh asdsd insert asdasd ClASSY
  asddsdff dfg  sdff sdf  CLASSY
  sdgg asfert dfg asd insert asdgweg CLASSY
  qwe asfer wrererw  werer wewer INSERT 
  </code></pre>
  
  <p><strong>I want to change the content of both the file as</strong> </p>
  
  <pre><code>File1.txt
  asd asdsd INSERT asdasd Vintage
  asddsdff sdf sdff sdf  CLASSY
  sfre asfert asdd asd insert asdgweg 
  qwe asfer wrererw  werer wewer INSERT Vintage
  
  File2.txt
  fhfgh asdsd insert asdasd Vintage
  asddsdff dfg  sdff sdf  CLASSY
  sdgg asfert dfg asd insert asdgweg Vintage
  qwe asfer wrererw  werer wewer INSERT 
  </code></pre>
  
  <p>Below is the command I used , but it is not working fine. Can you please help me understand the issue.</p>
  
  <pre><code>find /rootFolderPath -name "*.txt" | xargs grep -i insert -exec sed -i -e 'classy/Vintage/I' -- {} +
  </code></pre>