bash4 - bash: iterating through txt file lines can't read last line -


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

this code can read lines in file.txt except last line ideas why. thanks

if youre in doubt last \n in file, can try:

while read p; echo $p done < <(grep '' file.txt) 

grep not picky line endings ;)

you can use grep . file.txt skipping empty lines...


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Socket.connect doesn't throw exception in Android -

iphone - How do I keep MDScrollView from truncating my row headers and making my cells look bad? -