Monday, July 15, 2013

unix script file exists

I have a lists of files. Inside each file I have a list of files. I have to test that this files exist in directory /tmp I create this scprit to test pattern list of files dbpediaa? #pattern=`ls -la | awk '{print $9}' | grep -vE "\."`

for t in dbpediaa?
do
 echo "existe fichero $t ? "

 ficheros=`grep -i .nt.gz  $t | awk -F "'"  '{ print $4 }'`

 
 for fichero in $ficheros
 do
   if [ -f /tmp/$fichero  ]; then
     echo "."
    else
     echo "no existe $fichero"
   fi
 done;
done;