0

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.

1
  • Do you want the last 8 lines, or everything but the last 8 lines?
    – Kerrek SB
    Jun 28, 2011 at 1:57

1 Answer 1

3

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
1
  • Thanks! Wow i thought the -n was for a numeric offset. I'll give it try!
    – chrisjlee
    Jun 28, 2011 at 2:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .