while read line; do echo $line; done < file.txt

Category: Bash Scripting

while read line; do echo $line; done < file.txt

Read a file line by line with a while loop

Reads a file one line at a time and processes each line in the loop body.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.