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.

link|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
feedback

1 Answer

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
link|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
feedback

Your Answer

 
or
required, but never shown

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