title: Trying to remove non-printable characters (junk values) from a UNIX file
body: <p>I am trying to remove non-printable character (for e.g. <code>^@</code>) from records in my file. Since the volume to records is too big in the file using cat is not an option as the loop is taking too much time.
  I tried using </p>
  
  <pre><code>sed -i 's/[^@a-zA-Z 0-9`~!@#$%^&amp;*()_+\[\]\\{}|;'\'':",.\/&lt;&gt;?]//g' FILENAME
  </code></pre>
  
  <p>but still the <code>^@</code> characters are not removed.
  Also I tried using </p>
  
  <pre><code>awk '{ sub("[^a-zA-Z0-9\"!@#$%^&amp;*|_\[](){}", ""); print } FILENAME &gt; NEW FILE 
  </code></pre>
  
  <p>but it also did not help.</p>
  
  <p>Can anybody suggest some alternative way to remove non-printable characters?</p>
  
  <p>Used <code>tr -cd</code> but it is removing accented characters. But they are required in the file.</p>