while read p; do
echo $p
done < file.txt
this code can read all lines in the file.txt except the last line any ideas why. Thanks
if youre in doubt about the last \n
in the file, you can try:
while read p; do
echo $p
done < <(grep '' file.txt)
grep is not picky about the line endings ;)
you can use grep . file.txt
for skipping empty lines...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With