title: How to get max length of each column in unix?
body: <p>Suppose, I have a source file like this.</p>
  
  <pre><code>ID|NAME|ADDRESS
  1|ABC|PUNE
  2|XYZA|MUMBAI
  12|VB|NAGPUR
  </code></pre>
  
  <p>I want to get the maximum length of each column (excluding the header names).
  Output should be like this.
      2|4|6</p>
  
  <p>I have tried the command like this. 
       tail +2 filename | cut -d"|" -f1 | awk '{ print length }' | sort -r | uniq</p>
  
  <p>This works for 1st column. Is there any option available in awk to get max length for each column?</p>