Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

So I want to tail a file and remove the number of lines from the file is that possible with one line line in Linux? Almost essentially just moving lines of text from one file to another.

For example:

tail -8 foo-file.txt >> newfile.txt;

now... remove -8 lines from newfile.txt.

share|improve this question
    
Do you want the last 8 lines, or everything but the last 8 lines? –  Kerrek SB Jun 28 '11 at 1:57

1 Answer 1

up vote 3 down vote accepted

Your example is close, you just need to change the way you are asking for the lines. Below I changed your "-8" to "-n 8" to ask for 8 lines.

tail -n 8 foo-file.txt >> newfile.txt
share|improve this answer
    
Thanks! Wow i thought the -n was for a numeric offset. I'll give it try! –  chrisjlee Jun 28 '11 at 2:24

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.