Search code examples
ubuntucattail

combining cat and tail


I am trying to combine cat and tail commands:

Like this:

I have file name "text1" and want to combine to file name "text2". But first I wanted to remove 7 lines from file text1 before I combine to file "text2"

     tail --lines=+7 text1 | cat  text2 > out_put 

This does not work for me on Ubuntu 12.04


Solution

  • { tail --lines=+7 text1; cat text2; } > out_put 
    

    or

    tail --lines=+7 text1 | cat - text2 > out_put 
    

    Passing - tells cat to read from stdin first, then from text2.