Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to tail only the updated line of the file not entire content

tail -F /path to file

displays all the line from the file. I need to display only the new lines added to the file can anyone help me in this ?

Regards Chhaya

share|improve this question

1 Answer 1

tail -F -n0 file.txt

Man page about -n:

   -n, --lines=K
          output the last K lines, instead of the last 10; or use -n +K to
          output lines starting with the Kth
share|improve this answer
    
i want to see only updated lines in the file for e.g if file has 10 lines tail -F shows me 10 lines on terminal now if 5 more line are added i should be able to see only new 5 lines not all the 15 lines –  chhaya vishwakarma Dec 26 '13 at 9:32
    
Have you tried it? This is exactly what is does. n = 0, so it outputs 0 of the last lines. –  OrangeTux Dec 26 '13 at 9:36
    
i dont need 0 of the last line i need newly added line –  chhaya vishwakarma Dec 26 '13 at 9:40
    
What do you mean? This line does exactly want you need. It shows only the newly added lines. Have you tried it? –  OrangeTux Dec 26 '13 at 9:45
1  
@OrangeTux what he wants in comment is impossible. He wants to erase the 10 lines added but see the next new 5 lines. Then when 2 lines are added he wants the 5 to disappear and see the 2 new ones. Not possible. Even when erasing the file the output is still on the screen and you can not do a clear in between :) –  Rinzwind Dec 26 '13 at 9:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.