2016-04-13 08:55:16 -0400, Greg Wooledge: [...] > > And if you want to keep eventual spurious characters after the > > last NL character in the file: > > > > while IFS= read -r line; do printf '%s\n' "$line"; done < test.txt > > [ -z "$line" ] || printf %s "$line" > > Another way to write that is: > > while IFS= read -r line || [[ $line ]]; do ... done < test.txt [...]
Except that it would add an extra newline character (which may be desired as well). -- Stephane