Feb 032009
 

You might need to do something with a list of files contained in a file… and maybe these file names include spaces, therefore using a standard

for i in `cat filename`
do
echo $i
done

does not work since it will consider every word as a single variable.

This second script does the job:

IFS=\$    ==> this sets the line separator as EOL
while read i    ==> this read variables separated by EOL and stores value in $i
do
echo $i    ==> this echoes the value of $i. Replace echo command with whatever you want to do with filenames
done < file-containing-the-list    ==> this ends the while do cycle and takes input from file where filenames are stored