title: Matching the First Character on Each Line (UNIX egrep)
body: <p>I'm looking to match and return just the first character from each line in a plain-text UTF-8 encoded file using in a UNIX terminal using egrep. I presumed that the following egrep command with a simple RegEx would produce the desired result:</p>
  
  <pre><code>egrep -o "^." FILE.txt
  </code></pre>
  
  <p>However, the output appears to be matching and returning <em>every</em> character in the file; that is, it is behaving as if the command were:</p>
  
  <pre><code>egrep -o "." FILE.txt
  </code></pre>
  
  <p>Similar results occur with the following command,</p>
  
  <pre><code>egrep -o "^[a-z]" FILE.txt
  </code></pre>
  
  <p>namely, the results act as if the RegEx "[a-z]" were supplied (i.e., every lowercase ASCII character in the range a-z is matched).</p>
  
  <p>Commands in which just one specific alphanumeric characters ist supplied seem, as expected, to return every line that begins with the specific character, e.g.,</p>
  
  <pre><code>egrep -o "^1" FILE.txt
  </code></pre>
  
  <p>or
      egrep -o "^T" FILE.txt</p>
  
  <p>return all lines beginning with "1" or "T", respectively. </p>
  
  <p>I have tried pasting the entirety of the file into a RegEx tester, such as at <a href="https://regexr.com/" rel="nofollow noreferrer">https://regexr.com/</a>, and the expression "^." indeed behaves as expected, so I don't think that my file has any further whitespace characters that could be interfering.</p>
  
  <p>Is there some other behavior of the line-beginning metacharacter "^" with egrep that could be causing this problem?</p>