cat R2_20060719.610.txt | while read LINE
do
echo "$LINE"
done
or preferably
while read LINE
do
echo "$LINE"
done <R2_20060719.610.txt
Will not skip the last line, it will in effect behave exactly like the cat command. There are a number of ways you could aciehve the desired results. The simplest of which is probably to store the value of LINE in another variable, and print that value in the next iteration through the while loop.
R2_20060719.610.txt
--------------------
Dividend EventID IssID SecID Created
DIV 170334 3085 3225 2006/06/10
DIV 7034 305 325 2006/06/10 2006/06/12
DIV 3333 30333 325 2006/06/10 2006/06/12
if i use ur code to loop this data
while read LINE
do
echo "$LINE"
done <R2_20060719.610.txt
i am getting output as
Dividend EventID IssID SecID Created
DIV 170334 3085 3225 2006/06/10
DIV 7034 305 325 2006/06/10 2006/06/12
it's skipping last line.
if i use below code
while read LINE
do
echo "$LINE"
done <R2_20060719.610.txt
echo "$LINE"
it's giving me all lines as output including last line.
but my requirement is not that....
within the loop itself i should be able to echo all lines including last line.
there should not be any code outside loop.
Can you post the output of 'uname -n' and 'echo $0' commands? The code snippet posted by reborg should not be skipping any lines from the file at all...
Oh, sorry, I meant 'uname -a'. Anyway, with ksh you shouldn't be getting such an output. All lines should be printed. Can you just run 'cat -v' on the file and see if any chars are present that shouldn't be there?
You need to have a carriage return after the last line. vi the file and press 'enter' at the end of last line and save. They retry your code and it should work.