Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using this script to find information stored in one file using other file as a source for variables to look for:

while IFS= read -r line
echo $line
cat Inventory.csv | grep "$line" >> cuentasxcajas.txt
done < $file
echo "done"

but the file cuentasxcajas.txt is empty, any suggestions?

share|improve this question
Possible duplicate:… – Adobe Jul 7 '13 at 5:53

If I had your task to do, I would proceed thus:

grep -f '/home/victor/Documentos/Temporal/13-06-04_Cuentas_para_revisar_cajas.txt' -- Inventory.csv > cuentasxcajas.txt

No need for a Bash script, of for loops of for useless uses of cats. Just make sure you don't have empty lines in the file /home/victor/Documentos/Temporal/13-06-04_Cuentas_para_revisar_cajas.txt.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.