title: How to search a specific column in a file for a string in shell?
body: <p>I am learning shell scripting. I wrote a script that indexes all the files and folders in the current working directory in the following tab separated format,</p>
  
  <p>Path    Filename    File/Directory    Last Modified date    Size    Textfile(Y/N)</p>
  
  <p>for example, two lines in my file 'index.txt' are,</p>
  
  <pre><code>home/Desktop/C    C    d    Thu Jan 16 01:23:57 PST 2014    4 KB    N
  home/Desktop/C/100novels.txt    100novels.txt    f    Thu Mar 14 06:04:06 PST 2013    0 KB Y
  </code></pre>
  
  <p>Now, i want to write another script to search for files from the previous file that takes in command line parameters, the file name. And also optional parameters as -dir (if to search only for directories), -date DATE (for last modified date), -t (for text files only) etc. How to go about this ?</p>
  
  <p>I know the grep command that searches in a file for a string, but suppose i entered a file name, it would search the entire file for the file name instead of searching only the filename column. How do i do this? Is there any other command to achieve this ?</p>