-1

I was trying to print two files with a single command.

I have two files: file1 and file2.

I used cat file1 file2 > together to combine these two and get a new file together.

When I cat together, the content of two files is shown on the screen. However, I want to know if there is any way I can print out two files with one single command using cat?

  • 2
    uh... cat file1 file2 with no redirect does print file1 and file2 together ? – Zanna Aug 23 '16 at 17:27
  • 2
    @zanna we should make it dog file1 file2 – Jacob Vlijm Aug 23 '16 at 17:35
  • 1
    @JacobVlijm ah maybe you found the problem... cat got scared and ran away with the files – Zanna Aug 23 '16 at 17:37
  • 1
    I think cat is busy chasing the mouse. – wjandrea Aug 23 '16 at 17:43
2

Just running cat file1 file2 will do what you want.

When you add > together, you're telling the shell to send the output into the file together instead of printing the output on the screen.

0

This is still technically 2 commands, but it would still give a combined, uninterupted output: cat file1 && cat file2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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