title: Shell script to add a full stop at the end of each line (that do not contain a full stop) in a file
body: <p>I have a file with each line a sentence e.g.</p>
  
  <pre><code>Random stuff,
  "First sentence",
  "second sentence.",
  "Third sentence!"
  More Random Stuff,
  </code></pre>
  
  <p>and so on...</p>
  
  <p>I want to in-place modify only the quoted lines i.e. 2nd, 3rd and 4th line in the example above.</p>
  
  <p>I want to do the following modifications - </p>
  
  <ol>
  <li>Add a full stop at the end of line (if a full stop or exclamation mark is not present)</li>
  <li>Make first character capital (if its not already capital)</li>
  </ol>
  
  <p>I have tried the following solution to add a full stop - </p>
  
  <pre><code>sed -i 's/[^!.]",/.",/g' $file
  </code></pre>
  
  <p>The above command removes the last character of the sentence as -</p>
  
  <pre><code>"First sentenc.",
  </code></pre>
  
  <p>And if I try the following command - </p>
  
  <pre><code>sed -i 's/[^!.]",/&amp;.",/g' $file
  </code></pre>
  
  <p>I get result as follows - </p>
  
  <pre><code>"First sentence",.",
  </code></pre>
  
  <p>My desired output is - </p>
  
  <pre><code>"First sentence.",
  </code></pre>
  
  <p>How can this problem be solved correctly without getting undesired results as shown above?
  Also, how can I make the first character capital? </p>
  
  <p>The file after modification should be - </p>
  
  <pre><code>Random stuff,
  "First sentence.",
  "Second sentence.",
  "Third sentence!"
  More Random Stuff,
  </code></pre>