title: bash script - how to find and handle the last item read from a while loop using a case statement
body: <p>I'm using a <code>while</code> loop to read in a list of items in a file. Within the while loop, 
  i'm also using a <code>case</code> statement to handle particular conditions/columns. One condition that I cannot figure out is 
  how to handle the <em>last</em> item on the list.</p>
  
  <p>For example:</p>
  
  <pre><code>#!/usr/local/bin/bash
  FILE="myoutputfile.out";
  while IFS='' read -r column; do
    case column in
      visitor_id)
         echo "isnull($column|| '[|]' ||";;
         updated)
         echo "isnull($column::text || '[|]' ||";;
               *)
         echo "isnull($column::text,'[null!]') || '[|]' ||";;
    esac
  done &lt;"$FILE"
  </code></pre>
  
  <p>Let's say list contents are:</p>
  
  <pre><code>visitor_id
  updated
  visitor_list_1
  visitor_list_2
  visitor_list_3
  visitor_list_4
  visitor_list_5
  </code></pre>
  
  <p>I need to do something different with "<strong>visitor_list_5</strong>". Note, the list will be different each time except for the first 2 items which 
  I have a case for, but I need to handle the last one with something like so:</p>
  
  <pre><code>   last_column)
     echo "isnull(visitor_list_5::text,'[null!]')) as md5sum"
  </code></pre>