title: Bash - Read only the last 100 lines of a long Log file
body: <p>I am reading a long log file and splitting the columns in variables using bash.</p>
  
  <pre><code>cd $LOGDIR
  IFS="," 
  while read LogTIME name md5 
  do
      LogTime+="$(echo $LogTIME)"
      Name+="$(echo $name)"
      LOGDatamd5+="$(echo $md5)"
  done &lt; LOG.txt
  </code></pre>
  
  <p>But this is really slow and I don't need all the lines. The last 100 lines are enough (but the log file itself needs all the other lines for different programs).</p>
  
  <p>I tried to use <code>tail -n 10 LOG.txt | while read LogTIME name md5</code>, but that takes really long as well and I had no output at all.
  Another way I tested without success was:</p>
  
  <pre><code>cd $LOGDIR
  foo="$(tail -n 10 LOG.txt)"
  IFS="," 
  while read LogTIME name md5 
  do
      LogTime+="$(echo $LogTIME)"
      Name+="$(echo $name)"
      LOGDatamd5+="$(echo $md5)"
  done &lt; "$foo"
  </code></pre>
  
  <p>But that gives me only the output of foo in total. Nothing was written into the variables inside the while loop.</p>
  
  <p>There is probably a really easy way to do this, that I can't see...</p>
  
  <p>Cheers,
  BallerNacken</p>