unix: how to cat from 2 inputs? unix: how to cat from 2 inputs? unix unix

unix: how to cat from 2 inputs?


You could do the following (in bash):

(tail -4 file1; tail -4 file2) > file3

This doesn't use cat as per your question but it does achieve the goal you describe.


Bash has a process substitution feature:

  cat <(tail -4 file1) <(tail -4 file2)

I often use this feature to diff slightly altered versions of two files.


You could use pee from moreutils to do this. Here's my solution

pee 'tail file1' 'tail file2' </dev/null > file3