The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 11-16-2008
creepy cripple creepy cripple is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 2
There is no need for 2 loops, you have to use powerful unix commands in your scripts, like grep. This should work:
Of course, t.csv must be empty before executing the script.

while read LINE
do
aux=$(grep $LINE test.csv)
if [[ ! -z $aux ]]
then
echo "$aux" >> t.csv
else
echo "NA" >> t.csv
fi
done <tmplist.txt