title: How do you check if a text file had tab as its delimiter in bash?
body: <p>So I have a text file and it may have a tab as its field separator (delimiter) or it may have a space as a field separator. I would like to check if that text file is tabulated otherwise I will do something else with the file. I am using a bash script. So i'm open to anything with pure bash, sed, awk, grep, etc. (NOTE: that they are all GNU). So I am thinking of a structure like this:</p>
  
  <pre><code>if [if delimiter is tab]; then
      #do soemthing
  elif [if delimiter is space]; then
      #do something else
  fi
  </code></pre>
  
  <p>Any suggestions? Let me know if further explanation is required. Thanks!</p>
  
  <p>Here is an explanation <strong>update</strong> on what the text file looks like:</p>
  
  <p>If the text file has a tab as delimiter, then it delimited on every line. If the text file has a space as delimiter, then it is NOT delimited every line. </p>
  
  <p>Here are examples of possible text files that I might be facing:</p>
  
  <p><em>Delimiter is tab</em>:</p>
  
  <pre><code>col1   col2   col3
  -------
  1   2   3
  4   5   6
  </code></pre>
  
  <p><em>Delimiter is space</em>: (the space is between 12 and 3 &amp;&amp; 4 and 56)</p>
  
  <pre><code>col1col2col3
  -----------
  12 3
  4 56
  </code></pre>