title: Check record length for fixed width files
body: <p>In a Unix environment, I occasionally have some fixed width files for which I'd like to check the record lengths. For each file I'd like to catch if any records  are not an appropriate line number for further investigation; appropriate size is known a priori.</p>
  
  <p>If I want to check if all record lengths are the same, I simply run</p>
  
  <pre><code>zcat &lt;gzipped file&gt; | awk '{print length}' | sort -u
  </code></pre>
  
  <p>If there is more than one record length in the above command, then I run</p>
  
  <pre><code>zcat &lt;gzipped file&gt; | awk '{print length}' | nl -n rz -s "," &gt; recordLenghts.csv
  </code></pre>
  
  <p>which stores a record length for row in the original file.</p>
  
  <p><strong>What:</strong> Is this an efficient method, or is there a better way of checking record length for a file? </p>
  
  <p><strong>Why:</strong> The reason I ask is that some of these files can be a few GB in size while gzipped. So this process can take a while.</p>