title: How to use if loop with for loop in bash script?
body: <p>I have a passwd file which contains 35000 users and I only need to pull up 205 users. My script is working and giving me details. however, it only giving me 190 users. I assume all other left users do not have any entry in the file.
  I want to use an if loop if users exist to put in a found file and if not put in not found file?</p>
  
  <pre><code>#!/bin/bash
  
  ##/tmp/users.txt is file in which you initialize unix ids
  
  cat /tmp/users.txt | while read line
  
  do
  
  grep -w $line /var/yp/test/passwd | cut -d: -f1,2,3,5 &gt;&gt; /tmp/result.csv
  
  ##/tmp/result.csv will store the result
  
  done;
  </code></pre>