title: Search multiple strings from file in multiple files in specific column and output the count in unix shell scripting
body: <p>I have searched extensively on the internet about this but haven't found much details.</p>
  
  <p>Problem Description:</p>
  
  <p>I am using aix server.</p>
  
  <p>I have a pattern.txt file that contains customer_id for 100 customers in the following sample format:</p>
  
  <p>160471231</p>
  
  <p>765082023</p>
  
  <p>75635713</p>
  
  <p>797649756</p>
  
  <p>8011688321</p>
  
  <p>803056646</p>
  
  <p>I have a directory (/home/aswin/temp) with several files (1.txt, 2.txt, 3.txt and so on) which are pipe(|) delimited. Sample format:</p>
  
  <p>797649756|1001|123270361|797649756|O|2017-09-04 23:59:59|10|123769473
  803056646|1001|123345418|1237330|O|1999-02-13 00:00:00|4|1235092
  64600123|1001|123885297|1239127|O|2001-08-19 00:00:00|10|1233872
  75635713|1001|123644701|75635713|C|2006-11-30 00:00:00|11|12355753
  424346821|1001|123471924|12329388|O|1988-05-04 00:00:00|15|123351096
  427253285|1001|123179704|12358099|C|2012-05-10 18:00:00|7|12352893</p>
  
  <p>What I need to do search all the strings from pattern.txt file in all files in the directory, in first column of each file and list each filename with number of matches. so if same row has more than 1 match it should be counted as 1.</p>
  
  <p>So the output should be something like (only the matches in first column should count):</p>
  
  <p>1.txt:4</p>
  
  <p>2.txt:3</p>
  
  <p>3.txt:2</p>
  
  <p>4.txt:5</p>
  
  <p>What I have done till now:</p>
  
  <p>cd /home/aswin/temp</p>
  
  <p>grep -srcFf ./pattern.txt * /dev/null >> logfile.txt</p>
  
  <p>This is giving the output in the desired format, but it searching the strings in all columns and not just first column. So the output count is much more than expected.</p>
  
  <p>Please help.</p>