Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Often, you must iterate through items stored inside a file. This requires combining two of the techniques covered:
By changing the IFS environment variable, you can force the for command to handle each line in the file as a separate item for processing, even if the data contains spaces. Once you've extracted an individual line in the file, you may have to loop again to extract data contained within it.
The classic example of this is processing data in the /etc/passwd file. This requires that you iterate through the /etc/passwd file line by line and then change the IFS variable value to a colon so that you can separate out the individual components in each line.