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 -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -