-34

Tip #864   Read a file line-by-line

This short script reads a file line-by-line ( whith whitespace characters too ) and outputs to STDOUT.

#!/bin/bash
FILE='/path/to/filename'
for linecount in `seq $(cat $FILE | wc -l)`; do
line=`head -n$linecount $FILE | tail -1`
echo $line
done