Skip to content

Instantly share code, notes, and snippets.

@evandrix
Created June 26, 2013 00:31
Show Gist options
  • Select an option

  • Save evandrix/5863753 to your computer and use it in GitHub Desktop.

Select an option

Save evandrix/5863753 to your computer and use it in GitHub Desktop.
Correct way to read file line-by-line
k=1
while read line;do
echo "Line # $k: $line"
((k++))
done < $FILE
echo "Total number of lines in file: $k"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment