title: Grep search- Find duplicated data after specific word
body: <p>I need to compare two txt files (json). I think grep &amp; diff are what I need? but I'm very new to linux/programming.</p>
  
  <p>This is the search I need done:</p>
  
  <p>Look for: "prodId" in both documents.</p>
  
  <p>Search 7 characters after "prodId" in both documents. If matches are found, change the link after word "link".</p>
  
  <p>How can this be achieved in a Linux? Open to other solutions too.</p>
  
  <p>Example:</p>
  
  <p><strong>File 1</strong></p>
  
  <pre><code>{
  "name":"StackOver"
  "objectId": "52cZWVYWun",
  "price": "62.00",
  "prodId": "511040",
  "link": "www.link.com/1",
  
  },
  {
  "name":"Stackunder"
  "objectId": "28iuo899sum",
  "price": "10.00",
  "prodId": "524240",
  "link": "www.link.com/2",
  }
  </code></pre>
  
  <hr>
  
  <p><strong>File 2</strong></p>
  
  <pre><code>{
  "name":"Name1"
  "objectId": "126WVYWwzzn",
  "price": "2.00",
  "prodId": "546040",
  "link": "www.link.com/1_abcd",
  },
  {
  "name":"Name2"
  "objectId": "2wrw23um",
  "price": "115.00",
  "prodId": "524240",
  "link": "www.link.com/2_abcd",
  }
  </code></pre>
  
  <hr>
  
  <p><strong>Desired result</strong></p>
  
  <p>Where duplicate found after "prodID", change "link":"xx" to link that exists in <strong>File 1</strong></p>
  
  <p><strong>File 1</strong></p>
  
  <pre><code>{
  "name":"Stackunder"
  "objectId": "28iuo899sum",
  "price": "10.00",
  "prodId": "524240",
  "link": "www.link.com/2_abcd", //REPLACES this line data only IF a duplicate existed in File 2//
  }
  </code></pre>
  
  <hr>
  
  <p>Does that make any more sense? Hope someone can advise.</p>
  
  <p>Thanks</p>