title: Shell script to validate csv fields
body: <p>I have a csv file with 20 fields. I want to have a script to check if the file is valid according with the following points:</p>
  
  <ul>
  <li>It needs to have 20 fields separated by pipes.</li>
  <li>Each of the 20 fields should match a regex.</li>
  <li>Know the line and field number for any regex unmatch.</li>
  </ul>
  
  <p>ex:</p>
  
  <pre><code>f1|f2|f3|...|f20
  1|aaaa|Y|...|2014/06/25
  2|bb|Y...|2014/06/25
  3|ccc|N...|2014/06/25
  
  regex:
  f1 [0-9]
  f2 [a-z]{2,4}
  f3 [YN]
  .
  .
  .
  f20 [1-9][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]
  </code></pre>
  
  <p>What are the best shell tools to do it? Do you have any similar script?</p>