title: How can I delete a newline if it is the last character in a file?
body: <p>I have some files that I'd like to delete the last newline if it is the last character in a file.  <code>od -c</code> shows me that the command I run does write the file with a trailing new line:</p>
  
  <pre><code>0013600   n   t  &gt;  \n
  </code></pre>
  
  <p>I've tried a few tricks with sed but the best I could think of isn't doing the trick:</p>
  
  <pre><code>sed -e '$s/\(.*\)\n$/\1/' abc
  </code></pre>
  
  <p>Any ideas how to do this?</p>