title: Replacing part of a string with sed
body: <p>I know that some form of this question has been asked multiple times over, but I can't seem to get any of the solutions I've found to work. I have a line in a file that looks something like:</p>
  
  <p><code>&lt;package foo="bar" unique-identifier="NEEDS_TO_BE_REPLACED" version="foobar"&gt;</code></p>
  
  <p>I need to replace the part indicated above, but I seem to always change unwanted information as well. The text that needs to be replaced is different from file to file, so currently I'm using a wildcard in it's place. Below are the things I've tried.</p>
  
  <p><code>sed 's/unique\-identifier\=\".*\"/unique\-identifier\=\"NEW_TEXT\"/g' $file &gt;&gt; $newFile</code></p>
  
  <p><code>sed 's/\bunique\-identifier\=\".*\"\b/unique\-identifier\=\"NEW_TEXT\"/g' $file &gt;&gt; $newFile</code></p>
  
  <p><code>sed 's/\&lt;unique\-identifier\=\".*\"\&gt;/unique\-identifier\=\"NEW_TEXT\"/g' $file &gt;&gt; $newFile</code></p>
  
  <p><code>sed 's/[[:&lt;:]]unique\-identifier\=\".*\"[[:&gt;:]]/unique\-identifier\=\"NEW_TEXT\"/g' $file &gt;&gt; $newFile</code></p>
  
  <p>All of those are various solutions that I've found, the last being Mac OSX specific. Ideally I'd like to be able to replace just what's in the double-quotes, but my regex skills are lacking.</p>