title: Bash expr index command
body: <p>I am trying to get the index position using Bash 'expr index".</p>
  
  <p>e.g. </p>
  
  <pre><code>$ echo `expr index "Info.out.2014-02-08:INFO|SID:sXfzRjbmKbwX7jyaW1sog7n|Browser[Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0]" Mozilla`
  </code></pre>
  
  <p>I am trying to get the index position of the word "Mozilla", and then get the substring using index value.</p>
  
  <p>The result I got back is 4.  Is it the period after Info caus the issue?  How do I fix this issue?</p>
  
  <p>I followed the Advanced Bash scripting guide www.tldp.org/LDP/abs/html/‎. See section Table B-5. String Operations</p>
  
  <p>expr index "$string" $substring Numerical position in $string of first character in $substring* that matches [0 if no match, first character counts as position 1]</p>
  
  <p>I tried with something simple, and it works.</p>
  
  <p>I am running bash in cygwin.</p>
  
  <pre><code>$ ./bash --version
  GNU bash, version 4.1.10(4)-release (i686-pc-cygwin)
  Copyright (C) 2009 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later &lt;http://gnu.org/licenses/gpl.html&gt;
  
  This is free software; you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.
  </code></pre>
  
  <p>Thanks.</p>