How to cat two files after each other but omit the last/first line respectively?
I have two files I want to cat together. However, the last line of the first file and the first line of the last file should be omitted. I am sure this can be done in a UNIX shell (or rather, Cygwin). But how? $ head --lines=-1 file1 > res $ tail --lines=+2 file2 >> res you can use: head -n -1 file1 && tail -n +2 file2 head shows the first lines of a file, the param -n shows the first n lines of the file, but if you put a - before the number, it shows all the file except the last n lines. tail is analog.. for better reference: man head man tail head -n -1 file1 will print all lines in file1