How can I read a file (data stream, variable) line-by-line (and/or field-by-field)? Don't try to use "for". Use a while loop and the read command. Here is the basic template; there are many variations to discuss: line is a variable name, chosen by you. You can use any valid shell variable name(s) there; see field splitting below. < "$file" redirects the loop's input from a file whose name is store